;(() => {
  var e,
    t,
    n,
    i,
    o = {
      /**
       * 模块487 - 编码转换工具模块
       * 1. 提供UTF8与二进制之间的转换功能
       * 2. 包含字符串与字节数组的相互转换方法
       * 3. 支持URL编码/解码处理
       */
      487: (e) => {
        var t = {
          utf8: {
            stringToBytes: function (e) {
              return t.bin.stringToBytes(unescape(encodeURIComponent(e)))
            },
            bytesToString: function (e) {
              return decodeURIComponent(escape(t.bin.bytesToString(e)))
            }
          },
          bin: {
            stringToBytes: function (e) {
              for (var t = [], n = 0; n < e.length; n++) t.push(255 & e.charCodeAt(n))
              return t
            },
            bytesToString: function (e) {
              for (var t = [], n = 0; n < e.length; n++) t.push(String.fromCharCode(e[n]))
              return t.join('')
            }
          }
        }
        e.exports = t
      },
      /**
       * 模块12 - 二进制数据处理工具模块
       * 1. 提供Base64编解码功能
       * 2. 包含字节与字(word)的相互转换方法
       * 3. 支持字节数组与十六进制字符串的相互转换
       * 4. 提供随机字节生成和字节顺序处理功能
       */
      12: (e) => {
        var t, n
        ;(t = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'),
          (n = {
            rotl: function (e, t) {
              return (e << t) | (e >>> (32 - t))
            },
            rotr: function (e, t) {
              return (e << (32 - t)) | (e >>> t)
            },
            endian: function (e) {
              if (e.constructor == Number) return (16711935 & n.rotl(e, 8)) | (4278255360 & n.rotl(e, 24))
              for (var t = 0; t < e.length; t++) e[t] = n.endian(e[t])
              return e
            },
            randomBytes: function (e) {
              for (var t = []; e > 0; e--) t.push(Math.floor(256 * Math.random()))
              return t
            },
            bytesToWords: function (e) {
              for (var t = [], n = 0, i = 0; n < e.length; n++, i += 8) t[i >>> 5] |= e[n] << (24 - (i % 32))
              return t
            },
            wordsToBytes: function (e) {
              for (var t = [], n = 0; n < 32 * e.length; n += 8) t.push((e[n >>> 5] >>> (24 - (n % 32))) & 255)
              return t
            },
            bytesToHex: function (e) {
              for (var t = [], n = 0; n < e.length; n++)
                t.push((e[n] >>> 4).toString(16)), t.push((15 & e[n]).toString(16))
              return t.join('')
            },
            hexToBytes: function (e) {
              for (var t = [], n = 0; n < e.length; n += 2) t.push(parseInt(e.substr(n, 2), 16))
              return t
            },
            bytesToBase64: function (e) {
              for (var n = [], i = 0; i < e.length; i += 3)
                for (var o = (e[i] << 16) | (e[i + 1] << 8) | e[i + 2], r = 0; r < 4; r++)
                  8 * i + 6 * r <= 8 * e.length ? n.push(t.charAt((o >>> (6 * (3 - r))) & 63)) : n.push('=')
              return n.join('')
            },
            base64ToBytes: function (e) {
              e = e.replace(/[^A-Z0-9+\/]/gi, '')
              for (var n = [], i = 0, o = 0; i < e.length; o = ++i % 4)
                0 != o &&
                  n.push(
                    ((t.indexOf(e.charAt(i - 1)) & (Math.pow(2, -2 * o + 8) - 1)) << (2 * o)) |
                      (t.indexOf(e.charAt(i)) >>> (6 - 2 * o))
                  )
              return n
            }
          }),
          (e.exports = n)
      },
      /**
       * 模块738 - Buffer检测模块
       * 1. 提供Buffer对象的检测功能
       * 2. 判断对象是否为Node.js Buffer类型
       * 3. 兼容多种Buffer实现方式
       */
      738: (e) => {
        function t(e) {
          return !!e.constructor && 'function' == typeof e.constructor.isBuffer && e.constructor.isBuffer(e)
        }
        e.exports = function (e) {
          return (
            null != e &&
            (t(e) ||
              (function (e) {
                return 'function' == typeof e.readFloatLE && 'function' == typeof e.slice && t(e.slice(0, 0))
              })(e) ||
              !!e._isBuffer)
          )
        }
      },
      /**
       * 模块568 - MD5哈希计算模块
       * 1. 提供MD5哈希算法实现
       * 2. 支持字符串和二进制数据输入
       * 3. 可输出字节数组、十六进制字符串或Base64格式
       * 4. 包含MD5算法的核心处理函数(_ff, _gg, _hh, _ii)
       */
      568: (e, t, n) => {
        var i, o, r, a, s
        ;(i = n(12)),
          (o = n(487).utf8),
          (r = n(738)),
          (a = n(487).bin),
          ((s = function (e, t) {
            e.constructor == String
              ? (e = t && 'binary' === t.encoding ? a.stringToBytes(e) : o.stringToBytes(e))
              : r(e)
              ? (e = Array.prototype.slice.call(e, 0))
              : Array.isArray(e) || e.constructor === Uint8Array || (e = e.toString())
            for (
              var n = i.bytesToWords(e),
                c = 8 * e.length,
                d = 1732584193,
                l = -271733879,
                u = -1732584194,
                h = 271733878,
                p = 0;
              p < n.length;
              p++
            )
              n[p] = (16711935 & ((n[p] << 8) | (n[p] >>> 24))) | (4278255360 & ((n[p] << 24) | (n[p] >>> 8)))
            ;(n[c >>> 5] |= 128 << c % 32), (n[14 + (((c + 64) >>> 9) << 4)] = c)
            var f = s._ff,
              g = s._gg,
              m = s._hh,
              y = s._ii
            for (p = 0; p < n.length; p += 16) {
              var w = d,
                v = l,
                T = u,
                E = h
              ;(d = f(d, l, u, h, n[p + 0], 7, -680876936)),
                (h = f(h, d, l, u, n[p + 1], 12, -389564586)),
                (u = f(u, h, d, l, n[p + 2], 17, 606105819)),
                (l = f(l, u, h, d, n[p + 3], 22, -1044525330)),
                (d = f(d, l, u, h, n[p + 4], 7, -176418897)),
                (h = f(h, d, l, u, n[p + 5], 12, 1200080426)),
                (u = f(u, h, d, l, n[p + 6], 17, -1473231341)),
                (l = f(l, u, h, d, n[p + 7], 22, -45705983)),
                (d = f(d, l, u, h, n[p + 8], 7, 1770035416)),
                (h = f(h, d, l, u, n[p + 9], 12, -1958414417)),
                (u = f(u, h, d, l, n[p + 10], 17, -42063)),
                (l = f(l, u, h, d, n[p + 11], 22, -1990404162)),
                (d = f(d, l, u, h, n[p + 12], 7, 1804603682)),
                (h = f(h, d, l, u, n[p + 13], 12, -40341101)),
                (u = f(u, h, d, l, n[p + 14], 17, -1502002290)),
                (d = g(d, (l = f(l, u, h, d, n[p + 15], 22, 1236535329)), u, h, n[p + 1], 5, -165796510)),
                (h = g(h, d, l, u, n[p + 6], 9, -1069501632)),
                (u = g(u, h, d, l, n[p + 11], 14, 643717713)),
                (l = g(l, u, h, d, n[p + 0], 20, -373897302)),
                (d = g(d, l, u, h, n[p + 5], 5, -701558691)),
                (h = g(h, d, l, u, n[p + 10], 9, 38016083)),
                (u = g(u, h, d, l, n[p + 15], 14, -660478335)),
                (l = g(l, u, h, d, n[p + 4], 20, -405537848)),
                (d = g(d, l, u, h, n[p + 9], 5, 568446438)),
                (h = g(h, d, l, u, n[p + 14], 9, -1019803690)),
                (u = g(u, h, d, l, n[p + 3], 14, -187363961)),
                (l = g(l, u, h, d, n[p + 8], 20, 1163531501)),
                (d = g(d, l, u, h, n[p + 13], 5, -1444681467)),
                (h = g(h, d, l, u, n[p + 2], 9, -51403784)),
                (u = g(u, h, d, l, n[p + 7], 14, 1735328473)),
                (d = m(d, (l = g(l, u, h, d, n[p + 12], 20, -1926607734)), u, h, n[p + 5], 4, -378558)),
                (h = m(h, d, l, u, n[p + 8], 11, -2022574463)),
                (u = m(u, h, d, l, n[p + 11], 16, 1839030562)),
                (l = m(l, u, h, d, n[p + 14], 23, -35309556)),
                (d = m(d, l, u, h, n[p + 1], 4, -1530992060)),
                (h = m(h, d, l, u, n[p + 4], 11, 1272893353)),
                (u = m(u, h, d, l, n[p + 7], 16, -155497632)),
                (l = m(l, u, h, d, n[p + 10], 23, -1094730640)),
                (d = m(d, l, u, h, n[p + 13], 4, 681279174)),
                (h = m(h, d, l, u, n[p + 0], 11, -358537222)),
                (u = m(u, h, d, l, n[p + 3], 16, -722521979)),
                (l = m(l, u, h, d, n[p + 6], 23, 76029189)),
                (d = m(d, l, u, h, n[p + 9], 4, -640364487)),
                (h = m(h, d, l, u, n[p + 12], 11, -421815835)),
                (u = m(u, h, d, l, n[p + 15], 16, 530742520)),
                (d = y(d, (l = m(l, u, h, d, n[p + 2], 23, -995338651)), u, h, n[p + 0], 6, -198630844)),
                (h = y(h, d, l, u, n[p + 7], 10, 1126891415)),
                (u = y(u, h, d, l, n[p + 14], 15, -1416354905)),
                (l = y(l, u, h, d, n[p + 5], 21, -57434055)),
                (d = y(d, l, u, h, n[p + 12], 6, 1700485571)),
                (h = y(h, d, l, u, n[p + 3], 10, -1894986606)),
                (u = y(u, h, d, l, n[p + 10], 15, -1051523)),
                (l = y(l, u, h, d, n[p + 1], 21, -2054922799)),
                (d = y(d, l, u, h, n[p + 8], 6, 1873313359)),
                (h = y(h, d, l, u, n[p + 15], 10, -30611744)),
                (u = y(u, h, d, l, n[p + 6], 15, -1560198380)),
                (l = y(l, u, h, d, n[p + 13], 21, 1309151649)),
                (d = y(d, l, u, h, n[p + 4], 6, -145523070)),
                (h = y(h, d, l, u, n[p + 11], 10, -1120210379)),
                (u = y(u, h, d, l, n[p + 2], 15, 718787259)),
                (l = y(l, u, h, d, n[p + 9], 21, -343485551)),
                (d = (d + w) >>> 0),
                (l = (l + v) >>> 0),
                (u = (u + T) >>> 0),
                (h = (h + E) >>> 0)
            }
            return i.endian([d, l, u, h])
          })._ff = function (e, t, n, i, o, r, a) {
            var s = e + ((t & n) | (~t & i)) + (o >>> 0) + a
            return ((s << r) | (s >>> (32 - r))) + t
          }),
          (s._gg = function (e, t, n, i, o, r, a) {
            var s = e + ((t & i) | (n & ~i)) + (o >>> 0) + a
            return ((s << r) | (s >>> (32 - r))) + t
          }),
          (s._hh = function (e, t, n, i, o, r, a) {
            var s = e + (t ^ n ^ i) + (o >>> 0) + a
            return ((s << r) | (s >>> (32 - r))) + t
          }),
          (s._ii = function (e, t, n, i, o, r, a) {
            var s = e + (n ^ (t | ~i)) + (o >>> 0) + a
            return ((s << r) | (s >>> (32 - r))) + t
          }),
          (s._blocksize = 16),
          (s._digestsize = 16),
          (e.exports = function (e, t) {
            if (null == e) throw new Error('Illegal argument ' + e)
            var n = i.wordsToBytes(s(e, t))
            return t && t.asBytes ? n : t && t.asString ? a.bytesToString(n) : i.bytesToHex(n)
          })
      },
      /**
       * 模块614 - 微信JS-SDK封装模块
       * 1. 提供微信JS-SDK的完整功能封装
       * 2. 包含微信分享、支付、扫码等API
       * 3. 处理微信浏览器环境检测和兼容性
       * 4. 提供小程序相关功能支持
       */
      614: (e) => {
        var t
        ;(t = window),
          (e.exports = (function (e, t) {
            if (!e.jWeixin) {
              var n,
                i = {
                  config: 'preVerifyJSAPI',
                  onMenuShareTimeline: 'menu:share:timeline',
                  onMenuShareAppMessage: 'menu:share:appmessage',
                  onMenuShareQQ: 'menu:share:qq',
                  onMenuShareWeibo: 'menu:share:weiboApp',
                  onMenuShareQZone: 'menu:share:QZone',
                  previewImage: 'imagePreview',
                  getLocation: 'geoLocation',
                  openProductSpecificView: 'openProductViewWithPid',
                  addCard: 'batchAddCard',
                  openCard: 'batchViewCard',
                  chooseWXPay: 'getBrandWCPayRequest',
                  openEnterpriseRedPacket: 'getRecevieBizHongBaoRequest',
                  startSearchBeacons: 'startMonitoringBeacons',
                  stopSearchBeacons: 'stopMonitoringBeacons',
                  onSearchBeacons: 'onBeaconsInRange',
                  consumeAndShareCard: 'consumedShareCard',
                  openAddress: 'editAddress'
                },
                o = (function () {
                  var e = {}
                  for (var t in i) e[i[t]] = t
                  return e
                })(),
                r = e.document,
                a = r.title,
                s = navigator.userAgent.toLowerCase(),
                c = navigator.platform.toLowerCase(),
                d = !(!c.match('mac') && !c.match('win')),
                l = -1 != s.indexOf('wxdebugger'),
                u = -1 != s.indexOf('micromessenger'),
                h = -1 != s.indexOf('android'),
                p = -1 != s.indexOf('iphone') || -1 != s.indexOf('ipad'),
                f = (n = s.match(/micromessenger\/(\d+\.\d+\.\d+)/) || s.match(/micromessenger\/(\d+\.\d+)/))
                  ? n[1]
                  : '',
                g = { initStartTime: R(), initEndTime: 0, preVerifyStartTime: 0, preVerifyEndTime: 0 },
                m = {
                  version: 1,
                  appId: '',
                  initTime: 0,
                  preVerifyTime: 0,
                  networkType: '',
                  isPreVerifyOk: 1,
                  systemType: p ? 1 : h ? 2 : -1,
                  clientVersion: f,
                  url: encodeURIComponent(location.href)
                },
                y = {},
                w = { _completes: [] },
                v = { state: 0, data: {} }
              A(function () {
                g.initEndTime = R()
              })
              var T = !1,
                E = [],
                S = {
                  config: function (t) {
                    _('config', (y = t))
                    var n = !1 !== y.check
                    A(function () {
                      if (n)
                        C(
                          i.config,
                          { verifyJsApiList: U(y.jsApiList), verifyOpenTagList: U(y.openTagList) },
                          (function () {
                            ;(w._complete = function (e) {
                              ;(g.preVerifyEndTime = R()), (v.state = 1), (v.data = e)
                            }),
                              (w.success = function (e) {
                                m.isPreVerifyOk = 0
                              }),
                              (w.fail = function (e) {
                                w._fail ? w._fail(e) : (v.state = -1)
                              })
                            var e = w._completes
                            return (
                              e.push(function () {
                                !(function () {
                                  if (!(d || l || y.debug || f < '6.0.2' || m.systemType < 0)) {
                                    var e = new Image()
                                    ;(m.appId = y.appId),
                                      (m.initTime = g.initEndTime - g.initStartTime),
                                      (m.preVerifyTime = g.preVerifyEndTime - g.preVerifyStartTime),
                                      S.getNetworkType({
                                        isInnerInvoke: !0,
                                        success: function (t) {
                                          m.networkType = t.networkType
                                          var n =
                                            'https://open.weixin.qq.com/sdk/report?v=' +
                                            m.version +
                                            '&o=' +
                                            m.isPreVerifyOk +
                                            '&s=' +
                                            m.systemType +
                                            '&c=' +
                                            m.clientVersion +
                                            '&a=' +
                                            m.appId +
                                            '&n=' +
                                            m.networkType +
                                            '&i=' +
                                            m.initTime +
                                            '&p=' +
                                            m.preVerifyTime +
                                            '&u=' +
                                            m.url
                                          e.src = n
                                        }
                                      })
                                  }
                                })()
                              }),
                              (w.complete = function (t) {
                                for (var n = 0, i = e.length; n < i; ++n) e[n]()
                                w._completes = []
                              }),
                              w
                            )
                          })()
                        ),
                          (g.preVerifyStartTime = R())
                      else {
                        v.state = 1
                        for (var e = w._completes, t = 0, o = e.length; t < o; ++t) e[t]()
                        w._completes = []
                      }
                    }),
                      S.invoke ||
                        ((S.invoke = function (t, n, i) {
                          e.WeixinJSBridge && WeixinJSBridge.invoke(t, M(n), i)
                        }),
                        (S.on = function (t, n) {
                          e.WeixinJSBridge && WeixinJSBridge.on(t, n)
                        }))
                  },
                  ready: function (e) {
                    0 != v.state ? e() : (w._completes.push(e), !u && y.debug && e())
                  },
                  error: function (e) {
                    f < '6.0.2' || (-1 == v.state ? e(v.data) : (w._fail = e))
                  },
                  checkJsApi: function (e) {
                    C(
                      'checkJsApi',
                      { jsApiList: U(e.jsApiList) },
                      ((e._complete = function (e) {
                        if (h) {
                          var t = e.checkResult
                          t && (e.checkResult = JSON.parse(t))
                        }
                        e = (function (e) {
                          var t = e.checkResult
                          for (var n in t) {
                            var i = o[n]
                            i && ((t[i] = t[n]), delete t[n])
                          }
                          return e
                        })(e)
                      }),
                      e)
                    )
                  },
                  onMenuShareTimeline: function (e) {
                    I(
                      i.onMenuShareTimeline,
                      {
                        complete: function () {
                          C(
                            'shareTimeline',
                            {
                              title: e.title || a,
                              desc: e.title || a,
                              img_url: e.imgUrl || '',
                              link: e.link || location.href,
                              type: e.type || 'link',
                              data_url: e.dataUrl || ''
                            },
                            e
                          )
                        }
                      },
                      e
                    )
                  },
                  onMenuShareAppMessage: function (e) {
                    I(
                      i.onMenuShareAppMessage,
                      {
                        complete: function (t) {
                          'favorite' === t.scene
                            ? C('sendAppMessage', {
                                title: e.title || a,
                                desc: e.desc || '',
                                link: e.link || location.href,
                                img_url: e.imgUrl || '',
                                type: e.type || 'link',
                                data_url: e.dataUrl || ''
                              })
                            : C(
                                'sendAppMessage',
                                {
                                  title: e.title || a,
                                  desc: e.desc || '',
                                  link: e.link || location.href,
                                  img_url: e.imgUrl || '',
                                  type: e.type || 'link',
                                  data_url: e.dataUrl || ''
                                },
                                e
                              )
                        }
                      },
                      e
                    )
                  },
                  onMenuShareQQ: function (e) {
                    I(
                      i.onMenuShareQQ,
                      {
                        complete: function () {
                          C(
                            'shareQQ',
                            {
                              title: e.title || a,
                              desc: e.desc || '',
                              img_url: e.imgUrl || '',
                              link: e.link || location.href
                            },
                            e
                          )
                        }
                      },
                      e
                    )
                  },
                  onMenuShareWeibo: function (e) {
                    I(
                      i.onMenuShareWeibo,
                      {
                        complete: function () {
                          C(
                            'shareWeiboApp',
                            {
                              title: e.title || a,
                              desc: e.desc || '',
                              img_url: e.imgUrl || '',
                              link: e.link || location.href
                            },
                            e
                          )
                        }
                      },
                      e
                    )
                  },
                  onMenuShareQZone: function (e) {
                    I(
                      i.onMenuShareQZone,
                      {
                        complete: function () {
                          C(
                            'shareQZone',
                            {
                              title: e.title || a,
                              desc: e.desc || '',
                              img_url: e.imgUrl || '',
                              link: e.link || location.href
                            },
                            e
                          )
                        }
                      },
                      e
                    )
                  },
                  updateTimelineShareData: function (e) {
                    C('updateTimelineShareData', { title: e.title, link: e.link, imgUrl: e.imgUrl }, e)
                  },
                  updateAppMessageShareData: function (e) {
                    C('updateAppMessageShareData', { title: e.title, desc: e.desc, link: e.link, imgUrl: e.imgUrl }, e)
                  },
                  startRecord: function (e) {
                    C('startRecord', {}, e)
                  },
                  stopRecord: function (e) {
                    C('stopRecord', {}, e)
                  },
                  onVoiceRecordEnd: function (e) {
                    I('onVoiceRecordEnd', e)
                  },
                  playVoice: function (e) {
                    C('playVoice', { localId: e.localId }, e)
                  },
                  pauseVoice: function (e) {
                    C('pauseVoice', { localId: e.localId }, e)
                  },
                  stopVoice: function (e) {
                    C('stopVoice', { localId: e.localId }, e)
                  },
                  onVoicePlayEnd: function (e) {
                    I('onVoicePlayEnd', e)
                  },
                  uploadVoice: function (e) {
                    C('uploadVoice', { localId: e.localId, isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1 }, e)
                  },
                  downloadVoice: function (e) {
                    C(
                      'downloadVoice',
                      { serverId: e.serverId, isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1 },
                      e
                    )
                  },
                  translateVoice: function (e) {
                    C(
                      'translateVoice',
                      { localId: e.localId, isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1 },
                      e
                    )
                  },
                  chooseImage: function (e) {
                    C(
                      'chooseImage',
                      {
                        scene: '1|2',
                        count: e.count || 9,
                        sizeType: e.sizeType || ['original', 'compressed'],
                        sourceType: e.sourceType || ['album', 'camera']
                      },
                      ((e._complete = function (e) {
                        if (h) {
                          var t = e.localIds
                          try {
                            t && (e.localIds = JSON.parse(t))
                          } catch (e) {}
                        }
                      }),
                      e)
                    )
                  },
                  getLocation: function (e) {},
                  previewImage: function (e) {
                    C(i.previewImage, { current: e.current, urls: e.urls }, e)
                  },
                  uploadImage: function (e) {
                    C('uploadImage', { localId: e.localId, isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1 }, e)
                  },
                  downloadImage: function (e) {
                    C(
                      'downloadImage',
                      { serverId: e.serverId, isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1 },
                      e
                    )
                  },
                  getLocalImgData: function (e) {
                    !1 === T
                      ? ((T = !0),
                        C(
                          'getLocalImgData',
                          { localId: e.localId },
                          ((e._complete = function (e) {
                            if (((T = !1), 0 < E.length)) {
                              var t = E.shift()
                              wx.getLocalImgData(t)
                            }
                          }),
                          e)
                        ))
                      : E.push(e)
                  },
                  getNetworkType: function (e) {
                    C(
                      'getNetworkType',
                      {},
                      ((e._complete = function (e) {
                        e = (function (e) {
                          var t = e.errMsg
                          e.errMsg = 'getNetworkType:ok'
                          var n = e.subtype
                          if ((delete e.subtype, n)) e.networkType = n
                          else {
                            var i = t.indexOf(':'),
                              o = t.substring(i + 1)
                            switch (o) {
                              case 'wifi':
                              case 'edge':
                              case 'wwan':
                                e.networkType = o
                                break
                              default:
                                e.errMsg = 'getNetworkType:fail'
                            }
                          }
                          return e
                        })(e)
                      }),
                      e)
                    )
                  },
                  openLocation: function (e) {
                    C(
                      'openLocation',
                      {
                        latitude: e.latitude,
                        longitude: e.longitude,
                        name: e.name || '',
                        address: e.address || '',
                        scale: e.scale || 28,
                        infoUrl: e.infoUrl || ''
                      },
                      e
                    )
                  },
                  getLocation: function (e) {
                    C(
                      i.getLocation,
                      { type: (e = e || {}).type || 'wgs84' },
                      ((e._complete = function (e) {
                        delete e.type
                      }),
                      e)
                    )
                  },
                  hideOptionMenu: function (e) {
                    C('hideOptionMenu', {}, e)
                  },
                  showOptionMenu: function (e) {
                    C('showOptionMenu', {}, e)
                  },
                  closeWindow: function (e) {
                    C('closeWindow', {}, (e = e || {}))
                  },
                  hideMenuItems: function (e) {
                    C('hideMenuItems', { menuList: e.menuList }, e)
                  },
                  showMenuItems: function (e) {
                    C('showMenuItems', { menuList: e.menuList }, e)
                  },
                  hideAllNonBaseMenuItem: function (e) {
                    C('hideAllNonBaseMenuItem', {}, e)
                  },
                  showAllNonBaseMenuItem: function (e) {
                    C('showAllNonBaseMenuItem', {}, e)
                  },
                  scanQRCode: function (e) {
                    C(
                      'scanQRCode',
                      { needResult: (e = e || {}).needResult || 0, scanType: e.scanType || ['qrCode', 'barCode'] },
                      ((e._complete = function (e) {
                        if (p) {
                          var t = e.resultStr
                          if (t) {
                            var n = JSON.parse(t)
                            e.resultStr = n && n.scan_code && n.scan_code.scan_result
                          }
                        }
                      }),
                      e)
                    )
                  },
                  openAddress: function (e) {
                    C(
                      i.openAddress,
                      {},
                      ((e._complete = function (e) {
                        e = (function (e) {
                          return (
                            (e.postalCode = e.addressPostalCode),
                            delete e.addressPostalCode,
                            (e.provinceName = e.proviceFirstStageName),
                            delete e.proviceFirstStageName,
                            (e.cityName = e.addressCitySecondStageName),
                            delete e.addressCitySecondStageName,
                            (e.countryName = e.addressCountiesThirdStageName),
                            delete e.addressCountiesThirdStageName,
                            (e.detailInfo = e.addressDetailInfo),
                            delete e.addressDetailInfo,
                            e
                          )
                        })(e)
                      }),
                      e)
                    )
                  },
                  openProductSpecificView: function (e) {
                    C(
                      i.openProductSpecificView,
                      { pid: e.productId, view_type: e.viewType || 0, ext_info: e.extInfo },
                      e
                    )
                  },
                  addCard: function (e) {
                    for (var t = e.cardList, n = [], o = 0, r = t.length; o < r; ++o) {
                      var a = t[o],
                        s = { card_id: a.cardId, card_ext: a.cardExt }
                      n.push(s)
                    }
                    C(
                      i.addCard,
                      { card_list: n },
                      ((e._complete = function (e) {
                        var t = e.card_list
                        if (t) {
                          for (var n = 0, i = (t = JSON.parse(t)).length; n < i; ++n) {
                            var o = t[n]
                            ;(o.cardId = o.card_id),
                              (o.cardExt = o.card_ext),
                              (o.isSuccess = !!o.is_succ),
                              delete o.card_id,
                              delete o.card_ext,
                              delete o.is_succ
                          }
                          ;(e.cardList = t), delete e.card_list
                        }
                      }),
                      e)
                    )
                  },
                  chooseCard: function (e) {
                    C(
                      'chooseCard',
                      {
                        app_id: y.appId,
                        location_id: e.shopId || '',
                        sign_type: e.signType || 'SHA1',
                        card_id: e.cardId || '',
                        card_type: e.cardType || '',
                        card_sign: e.cardSign,
                        time_stamp: e.timestamp + '',
                        nonce_str: e.nonceStr
                      },
                      ((e._complete = function (e) {
                        ;(e.cardList = e.choose_card_info), delete e.choose_card_info
                      }),
                      e)
                    )
                  },
                  openCard: function (e) {
                    for (var t = e.cardList, n = [], o = 0, r = t.length; o < r; ++o) {
                      var a = t[o],
                        s = { card_id: a.cardId, code: a.code }
                      n.push(s)
                    }
                    C(i.openCard, { card_list: n }, e)
                  },
                  consumeAndShareCard: function (e) {
                    C(i.consumeAndShareCard, { consumedCardId: e.cardId, consumedCode: e.code }, e)
                  },
                  chooseWXPay: function (e) {
                    C(i.chooseWXPay, x(e), e)
                  },
                  openEnterpriseRedPacket: function (e) {
                    C(i.openEnterpriseRedPacket, x(e), e)
                  },
                  startSearchBeacons: function (e) {
                    C(i.startSearchBeacons, { ticket: e.ticket }, e)
                  },
                  stopSearchBeacons: function (e) {
                    C(i.stopSearchBeacons, {}, e)
                  },
                  onSearchBeacons: function (e) {
                    I(i.onSearchBeacons, e)
                  },
                  openEnterpriseChat: function (e) {
                    C('openEnterpriseChat', { useridlist: e.userIds, chatname: e.groupName }, e)
                  },
                  launchMiniProgram: function (e) {
                    C(
                      'launchMiniProgram',
                      {
                        targetAppId: e.targetAppId,
                        path: (function (e) {
                          if ('string' == typeof e && 0 < e.length) {
                            var t = e.split('?')[0],
                              n = e.split('?')[1]
                            return (t += '.html'), void 0 !== n ? t + '?' + n : t
                          }
                        })(e.path),
                        envVersion: e.envVersion
                      },
                      e
                    )
                  },
                  openBusinessView: function (e) {
                    C(
                      'openBusinessView',
                      { businessType: e.businessType, queryString: e.queryString || '', envVersion: e.envVersion },
                      ((e._complete = function (e) {
                        if (h) {
                          var t = e.extraData
                          if (t)
                            try {
                              e.extraData = JSON.parse(t)
                            } catch (t) {
                              e.extraData = {}
                            }
                        }
                      }),
                      e)
                    )
                  },
                  miniProgram: {
                    navigateBack: function (e) {
                      ;(e = e || {}),
                        A(function () {
                          C('invokeMiniProgramAPI', { name: 'navigateBack', arg: { delta: e.delta || 1 } }, e)
                        })
                    },
                    navigateTo: function (e) {
                      A(function () {
                        C('invokeMiniProgramAPI', { name: 'navigateTo', arg: { url: e.url } }, e)
                      })
                    },
                    redirectTo: function (e) {
                      A(function () {
                        C('invokeMiniProgramAPI', { name: 'redirectTo', arg: { url: e.url } }, e)
                      })
                    },
                    switchTab: function (e) {
                      A(function () {
                        C('invokeMiniProgramAPI', { name: 'switchTab', arg: { url: e.url } }, e)
                      })
                    },
                    reLaunch: function (e) {
                      A(function () {
                        C('invokeMiniProgramAPI', { name: 'reLaunch', arg: { url: e.url } }, e)
                      })
                    },
                    postMessage: function (e) {
                      A(function () {
                        C('invokeMiniProgramAPI', { name: 'postMessage', arg: e.data || {} }, e)
                      })
                    },
                    getEnv: function (t) {
                      A(function () {
                        t({ miniprogram: 'miniprogram' === e.__wxjs_environment })
                      })
                    }
                  }
                },
                b = 1,
                k = {}
              return (
                r.addEventListener(
                  'error',
                  function (e) {
                    if (!h) {
                      var t = e.target,
                        n = t.tagName,
                        i = t.src
                      if (
                        ('IMG' == n || 'VIDEO' == n || 'AUDIO' == n || 'SOURCE' == n) &&
                        -1 != i.indexOf('wxlocalresource://')
                      ) {
                        e.preventDefault(), e.stopPropagation()
                        var o = t['wx-id']
                        if ((o || ((o = b++), (t['wx-id'] = o)), k[o])) return
                        ;(k[o] = !0),
                          wx.ready(function () {
                            wx.getLocalImgData({
                              localId: i,
                              success: function (e) {
                                t.src = e.localData
                              }
                            })
                          })
                      }
                    }
                  },
                  !0
                ),
                r.addEventListener(
                  'load',
                  function (e) {
                    if (!h) {
                      var t = e.target,
                        n = t.tagName
                      if ((t.src, 'IMG' == n || 'VIDEO' == n || 'AUDIO' == n || 'SOURCE' == n)) {
                        var i = t['wx-id']
                        i && (k[i] = !1)
                      }
                    }
                  },
                  !0
                ),
                t && (e.wx = e.jWeixin = S),
                S
              )
            }
            function C(t, n, i) {
              e.WeixinJSBridge
                ? WeixinJSBridge.invoke(t, M(n), function (e) {
                    V(t, e, i)
                  })
                : _(t, i)
            }
            function I(t, n, i) {
              e.WeixinJSBridge
                ? WeixinJSBridge.on(t, function (e) {
                    i && i.trigger && i.trigger(e), V(t, e, n)
                  })
                : _(t, i || n)
            }
            function M(e) {
              return (
                ((e = e || {}).appId = y.appId),
                (e.verifyAppId = y.appId),
                (e.verifySignType = 'sha1'),
                (e.verifyTimestamp = y.timestamp + ''),
                (e.verifyNonceStr = y.nonceStr),
                (e.verifySignature = y.signature),
                e
              )
            }
            function x(e) {
              return {
                timeStamp: e.timestamp + '',
                nonceStr: e.nonceStr,
                package: e.package,
                paySign: e.paySign,
                signType: e.signType || 'SHA1'
              }
            }
            function V(e, t, n) {
              ;('openEnterpriseChat' != e && 'openBusinessView' !== e) || (t.errCode = t.err_code),
                delete t.err_code,
                delete t.err_desc,
                delete t.err_detail
              var i = t.errMsg
              i ||
                ((i = t.err_msg),
                delete t.err_msg,
                (i = (function (e, t) {
                  var n = e,
                    i = o[n]
                  i && (n = i)
                  var r = 'ok'
                  if (t) {
                    var a = t.indexOf(':')
                    'confirm' == (r = t.substring(a + 1)) && (r = 'ok'),
                      'failed' == r && (r = 'fail'),
                      -1 != r.indexOf('failed_') && (r = r.substring(7)),
                      -1 != r.indexOf('fail_') && (r = r.substring(5)),
                      ('access denied' != (r = (r = r.replace(/_/g, ' ')).toLowerCase()) &&
                        'no permission to execute' != r) ||
                        (r = 'permission denied'),
                      'config' == n && 'function not exist' == r && (r = 'ok'),
                      '' == r && (r = 'fail')
                  }
                  return n + ':' + r
                })(e, i)),
                (t.errMsg = i)),
                (n = n || {})._complete && (n._complete(t), delete n._complete),
                (i = t.errMsg || ''),
                y.debug && !n.isInnerInvoke && alert(JSON.stringify(t))
              var r = i.indexOf(':')
              switch (i.substring(r + 1)) {
                case 'ok':
                  n.success && n.success(t)
                  break
                case 'cancel':
                  n.cancel && n.cancel(t)
                  break
                default:
                  n.fail && n.fail(t)
              }
              n.complete && n.complete(t)
            }
            function U(e) {
              if (e) {
                for (var t = 0, n = e.length; t < n; ++t) {
                  var o = e[t],
                    r = i[o]
                  r && (e[t] = r)
                }
                return e
              }
            }
            function _(e, t) {
              if (!(!y.debug || (t && t.isInnerInvoke))) {
                var n = o[e]
                n && (e = n), t && t._complete && delete t._complete, console.log('"' + e + '",', t || '')
              }
            }
            function R() {
              return new Date().getTime()
            }
            function A(t) {
              u && (e.WeixinJSBridge ? t() : r.addEventListener && r.addEventListener('WeixinJSBridgeReady', t, !1))
            }
          })(t))
      },
      /**
       * 模块661 - 版本信息模块
       * 1. 提供SDK版本号信息
       * 2. 导出当前SDK版本号常量
       * 3. 使用严格模式确保代码质量
       */
      661: (e) => {
        'use strict'
        e.exports = { i8: '2.4.6' }
      }
    },
    r = {}
  /**
   * 模块加载函数
   * @param {number} e - 模块ID
   * @returns {Object} 返回模块的exports对象
   */
  function a(e) {
    var t = r[e]
    if (void 0 !== t) return t.exports
    var n = (r[e] = { exports: {} })
    return o[e].call(n.exports, n, n.exports, a), n.exports
  }
  ;(a.m = o),
    /**
     * ES模块兼容性处理函数
     * @param {Object} e - 模块对象
     * @returns {Function} 返回模块的默认导出或模块本身
     * 1. 如果是ES模块则返回其default导出，否则返回模块本身
     * 2. 使用a.d方法定义模块的getter
     */
    (a.n = (e) => {
      var t = e && e.__esModule ? () => e.default : () => e
      return a.d(t, { a: t }), t
    }),
    (t = Object.getPrototypeOf ? (e) => Object.getPrototypeOf(e) : (e) => e.__proto__),
    (a.t = function (n, i) {
      if ((1 & i && (n = this(n)), 8 & i)) return n
      if ('object' == typeof n && n) {
        if (4 & i && n.__esModule) return n
        if (16 & i && 'function' == typeof n.then) return n
      }
      var o = Object.create(null)
      a.r(o)
      var r = {}
      e = e || [null, t({}), t([]), t(t)]
      for (var s = 2 & i && n; 'object' == typeof s && !~e.indexOf(s); s = t(s))
        Object.getOwnPropertyNames(s).forEach((e) => (r[e] = () => n[e]))
      return (r.default = () => n), a.d(o, r), o
    }),
    (a.d = (e, t) => {
      for (var n in t) a.o(t, n) && !a.o(e, n) && Object.defineProperty(e, n, { enumerable: !0, get: t[n] })
    }),
    (a.f = {}),
    (a.e = (e) => Promise.all(Object.keys(a.f).reduce((t, n) => (a.f[n](e, t), t), []))),
    (a.u = (e) => (400 === e ? 'vconsole' : e) + '.' + a.h() + '.js'),
    (a.miniCssF = (e) => {}),
    (a.h = () => '39dc226784c96d3b0498'),
    (a.g = (function () {
      if ('object' == typeof globalThis) return globalThis
      try {
        return this || new Function('return this')()
      } catch (e) {
        if ('object' == typeof window) return window
      }
    })()),
    (a.o = (e, t) => Object.prototype.hasOwnProperty.call(e, t)),
    (n = {}),
    (i = 'weco-src:'),
    (a.l = (e, t, o, r) => {
      if (n[e]) n[e].push(t)
      else {
        var s, c
        if (void 0 !== o)
          for (var d = document.getElementsByTagName('script'), l = 0; l < d.length; l++) {
            var u = d[l]
            if (u.getAttribute('src') == e || u.getAttribute('data-webpack') == i + o) {
              s = u
              break
            }
          }
        s ||
          ((c = !0),
          ((s = document.createElement('script')).charset = 'utf-8'),
          (s.timeout = 120),
          a.nc && s.setAttribute('nonce', a.nc),
          s.setAttribute('data-webpack', i + o),
          (s.src = e)),
          (n[e] = [t])
        var h = (t, i) => {
            ;(s.onerror = s.onload = null), clearTimeout(p)
            var o = n[e]
            if ((delete n[e], s.parentNode && s.parentNode.removeChild(s), o && o.forEach((e) => e(i)), t)) return t(i)
          },
          p = setTimeout(h.bind(null, void 0, { type: 'timeout', target: s }), 12e4)
        ;(s.onerror = h.bind(null, s.onerror)), (s.onload = h.bind(null, s.onload)), c && document.head.appendChild(s)
      }
    }),
    (a.r = (e) => {
      'undefined' != typeof Symbol &&
        Symbol.toStringTag &&
        Object.defineProperty(e, Symbol.toStringTag, { value: 'Module' }),
        Object.defineProperty(e, '__esModule', { value: !0 })
    }),
    (() => {
      var e
      a.g.importScripts && (e = a.g.location + '')
      var t = a.g.document
      if (!e && t && (t.currentScript && (e = t.currentScript.src), !e)) {
        var n = t.getElementsByTagName('script')
        n.length && (e = n[n.length - 1].src)
      }
      if (!e) throw new Error('Automatic publicPath is not supported in this browser')
      ;(e = e
        .replace(/#.*$/, '')
        .replace(/\?.*$/, '')
        .replace(/\/[^\/]+$/, '/')),
        (a.p = e)
    })(),
    (() => {
      a.b = document.baseURI || self.location.href
      var e = { 826: 0 }
      a.f.j = (t, n) => {
        var i = a.o(e, t) ? e[t] : void 0
        if (0 !== i)
          if (i) n.push(i[2])
          else {
            var o = new Promise((n, o) => (i = e[t] = [n, o]))
            n.push((i[2] = o))
            var r = a.p + a.u(t),
              s = new Error()
            a.l(
              r,
              (n) => {
                if (a.o(e, t) && (0 !== (i = e[t]) && (e[t] = void 0), i)) {
                  var o = n && ('load' === n.type ? 'missing' : n.type),
                    r = n && n.target && n.target.src
                  ;(s.message = 'Loading chunk ' + t + ' failed.\n(' + o + ': ' + r + ')'),
                    (s.name = 'ChunkLoadError'),
                    (s.type = o),
                    (s.request = r),
                    i[1](s)
                }
              },
              'chunk-' + t,
              t
            )
          }
      }
      var t = (t, n) => {
          var i,
            o,
            [r, s, c] = n,
            d = 0
          if (r.some((t) => 0 !== e[t])) {
            for (i in s) a.o(s, i) && (a.m[i] = s[i])
            if (c) c(a)
          }
          for (t && t(n); d < r.length; d++) (o = r[d]), a.o(e, o) && e[o] && e[o][0](), (e[o] = 0)
        },
        n = (this.webpackChunkweco_src = this.webpackChunkweco_src || [])
      n.forEach(t.bind(null, 0)), (n.push = t.bind(null, n.push.bind(n)))
    })(),
    (() => {
      'use strict'
      /** 微信JS-SDK封装模块 */
      var e = a(614),
        t = a.n(e)
      const n = 'https://rerearapi.wecodetrace.com',
        i = 'https://trace.wecodetrace.com'
      /** 型号 枚举 */
      var o
      !(function (e) {
        ;(e[(e.miniprogram = 0)] = 'miniprogram'),
          (e[(e.web = 1)] = 'web'),
          (e[(e.ios = 2)] = 'ios'),
          (e[(e.android = 3)] = 'android')
      })(o || (o = {}))
      o.miniprogram, o.web, o.ios, o.android
      /** 距离 枚举 */
      var r
      !(function (e) {
        ;(e[(e.near = 0)] = 'near'), (e[(e.middle = 1)] = 'middle'), (e[(e.far = 2)] = 'far')
      })(r || (r = {}))
      const s = { [r.near]: '近(2-5)', [r.middle]: '中(5-10)', [r.far]: '远(10+)' }
      r.near, r.near, r.middle, r.middle, r.far, r.far
      /** 异常 枚举 */
      var c
      !(function (e) {
        ;(e[(e.unable = 0)] = 'unable'), (e[(e.display = 1)] = 'display'), (e[(e.doubt = 2)] = 'doubt')
      })(c || (c = {}))
      const d = { [c.unable]: '无法扫码', [c.display]: '显示异常', [c.doubt]: '结果存疑' }
      c.unable, c.unable, c.display, c.display, c.doubt, c.doubt
      var l
      /** 档位  枚举 */
      !(function (e) {
        ;(e[(e.wdj = 0)] = 'wdj'), (e[(e.wdsy = 1)] = 'wdsy'), (e[(e.third = 3)] = 'third')
      })(l || (l = {}))
      l.wdj, l.wdsy, l.third
      var u
      !(function (e) {
        ;(e[(e.miniprogram = 1)] = 'miniprogram'),
          (e[(e.web = 2)] = 'web'),
          (e[(e.android = 3)] = 'android'),
          (e[(e.ios = 4)] = 'ios')
      })(u || (u = {}))
      /** MD5哈希计算模块 */
      const h = a(568)
      // 将json转参数字符
      function p(e) {
        const t = []
        for (const n in e)
          Object.prototype.hasOwnProperty.call(e, n) && t.push(`${encodeURIComponent(n)}=${encodeURIComponent(e[n])}`)
        return t.sort(), t.join('&')
      }
      /**
       * 生成带签名的请求参数
       * @param {Object} e - 请求参数对象
       * @param {string} [t] - 应用ID，默认为生产环境appId
       * @param {string} [n] - 应用密钥，默认为生产环境appKey
       * @returns {string} 返回MD5哈希后的签名字符串
       * 1. 将参数对象转换为键值对字符串
       * 2. 拼接appId和appKey
       * 3. 使用MD5算法生成签名
       */
      function f(e, t, n) {
        return h(
          (t || g('production').appId) +
            (function (e) {
              const t = []
              for (const n in e) Object.prototype.hasOwnProperty.call(e, n) && t.push(`${n}=${e[n]}`)
              return t.sort(), t.join('&')
            })(e) +
            (n || g('production').appKey)
        ).toString()
      }
      //获取 appid appkey
      function g(e) {
        return 'production' === e
          ? { appId: 'identify_sdk', appKey: 'cqMWZt9JGrmHtmJ7' }
          : { appId: 'identify_sdk', appKey: '2nWyg41NZAxbgNd0' }
      }
      // m 2K分辨率(2048×1080) y 3K分辨率(3036×2024) w 4K分辨率(4096×2160)
      const { TWO_K: m, THREE_K: y, FOUR_K: w } = { TWO_K: 2048, THREE_K: 3036, FOUR_K: 4096 }
      /** 是否为Android移动设备 */
      const v =
        (/Android|HarmonyOS|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),
        /Android/i.test(navigator.userAgent))
      /** 移动设备2K 其他设备3K */
      let T = v ? m : y
      /** 摄像头初始化状态标志，false 表示未初始化完成 */
      let E = !1
      class S extends Error {
        constructor(e) {
          super(e), (this.name = 'CompatibilityError'), Object.setPrototypeOf(this, S.prototype)
        }
      }
      /**
       * 初始化并启动摄像头
       * @param {HTMLVideoElement} e - 视频元素，用于显示摄像头画面
       * @param {number} t - 视频宽度
       * @param {number} n - 视频高度
       */
      async function b(e, t, n) {
        // 兼容旧版本
        !(function () {
          if (
            (void 0 === navigator.mediaDevices && (navigator.mediaDevices = {}),
            void 0 === navigator.mediaDevices.enumerateDevices)
          )
            throw new S('当前浏览器不支持enumerateDevices API')
          void 0 === navigator.mediaDevices.getUserMedia &&
            (navigator.mediaDevices.getUserMedia = function (e) {
              const t = navigator.webkitGetUserMedia || navigator.mozGetUserMedia
              return t
                ? new Promise((n, i) => {
                    t.call(navigator, e, n, i)
                  })
                : Promise.reject(new S('当前浏览器不支持getUserMedia API'))
            })
        })()
        // 获取授权
        e.srcObject instanceof MediaStream && e.srcObject.getTracks().forEach((e) => e.stop())
        // 计算视频宽高比例
        const i = t / n
        // 判断是否为竖屏模式(高度大于宽度)
        const o = n > t
        // 获取最佳摄像头设备配置
        const r = (function (e) {
          //移动设备
          if (v) return e.length > 0 ? { deviceId: e[e.length - 1].deviceId } : {}
          //其他设备
          for (const t of e)
            if ('getCapabilities' in t) {
              const e = t.getCapabilities()
              if (e) {
                const n = (e.width ?? { max: 0 }).max ?? 0,
                  i = (e.height ?? { max: 0 }).max ?? 0,
                  o = Math.max(n, i)
                return o >= w ? ((T = w), { deviceId: t.deviceId }) : (o >= y && (T = y), { deviceId: t.deviceId })
              }
            }
          return {}
        })((await navigator.mediaDevices.enumerateDevices()).filter((e) => 'videoinput' === e.kind))
        // 根据比例设置宽高值
        if (
          (o ? ((r.width = Math.round(T * i)), (r.height = T)) : ((r.width = T), (r.height = Math.round(T / i))), v)
        ) {
          const e = r.width
          ;(r.width = r.height), (r.height = e)
        }
        // 配置获取摄像头参数
        let a
        ;(void 0 !== r.deviceId && '' !== r.deviceId) || (delete r.deviceId, (r.facingMode = 'environment'))
        try {
          a = await navigator.mediaDevices.getUserMedia({ video: r })
        } catch (e) {
          throw (
            ((E = !1),
            'NotAllowedError' === e.name
              ? new ee('摄像机使用权限被拒绝')
              : e instanceof OverconstrainedError
              ? new S(`当前设备无法满足摄像头使用条件（${e.constraint}）`)
              : new S(e.message))
          )
        }
        if ('srcObject' in e)
          try {
            e.srcObject = a
          } catch (t) {
            if ('TypeError' !== t.name) throw t
            e.src = URL.createObjectURL(a)
          }
        else e.src = URL.createObjectURL(a)
        E = a instanceof MediaStream
      }

      /**
       * 从视频/图像中捕获并处理指定区域的帧数据
       * @param {HTMLVideoElement|HTMLImageElement} e - 视频或图像元素
       * @param {number} t - 目标处理区域的尺寸
       * @param {number} n - 水平偏移比例(-1到1)
       * @param {number} i - 垂直偏移比例(-1到1)
       * @param {CanvasRenderingContext2D} o - 画布上下文
       * @param {boolean} r - 是否反转颜色
       * @returns {Uint8Array} 处理后的图像数据
       */
      function k(e, t, n, i, o, r) {
        const [a, s] =
            e instanceof HTMLImageElement ? [e.naturalWidth, e.naturalHeight] : [e.videoWidth, e.videoHeight],
          c = Math.min(a, t),
          d = Math.min(s, t),
          l = Math.max(0, Math.min(a - c, a / 2 + n * c)),
          u = Math.max(0, Math.min(s - d, s / 2 + i * d)),
          h = d / c
        o.filter && (o.filter = `grayscale(1) invert(${r ? 1 : 0})`), o.drawImage(e, l, u, c, d, 0, 0, 480, 480 * h)
        const p = Uint8Array.from(o.getImageData(0, 0, 480, 480).data)
        return o.filter
          ? (function (e, t) {
              const n = new Uint8Array(e.length / 4)
              for (let i = 0, o = t; i < n.length; ++i, o += 4) n[i] = e[o]
              return n
            })(p, 0)
          : (function (e, t) {
              const n = new Uint8Array(e.length / 4)
              if (t)
                for (let t = 0, i = 0; t < n.length; ++t, i += 4)
                  n[t] = 255 - (0.3 * e[i] + 0.59 * e[i + 1] + 0.11 * e[i + 2])
              else
                for (let t = 0, i = 0; t < n.length; ++t, i += 4) n[t] = 0.3 * e[i] + 0.59 * e[i + 1] + 0.11 * e[i + 2]
              return n
            })(p, r)
      }
      const C = { appId: 'web_trace', appKey: 'MR3axyoWemPpgLlh' }
      let I = !1

      /**
       * 创建并配置一个DOM元素
       * @param {string} e - 元素标签名
       * @param {Object} t - 元素配置对象
       * @param {string} [t.id] - 元素ID
       * @param {Array} [t.classes] - 类名数组
       * @param {Function} [t.onClick] - 点击事件处理函数
       * @param {boolean} [t.controls] - 是否添加controls属性
       * @param {string} [t.src] - 资源路径
       * @param {boolean} [t.autoplay] - 是否自动播放
       * @param {Array} [n=[]] - 子元素数组
       * @returns {HTMLElement} 创建的元素
       */
      function M(e, t, n = []) {
        const i = document.createElement(e)
        t.id && (i.id = t.id)
        for (const e of t.classes ?? []) i.classList.add(e)
        t.onClick && A(i, 'click', t.onClick),
          t.controls && i.setAttribute('controls', ''),
          t.src && (i.src = t.src),
          t.autoplay && ((i.autoplay = !0), (i.preload = 'auto'))
        for (const e of n) 'string' == typeof e ? i.appendChild(document.createTextNode(e)) : i.appendChild(e)
        return i
      }

      /**
       * 解析URL查询参数为对象
       * @param {string} [e] - 要解析的URL字符串，默认为当前页面URL
       * @returns {Object} 包含查询参数键值对的对象
       */
      function x(e) {
        return new URL(e || a.g.location.href).search
          .substring(1)
          .split('&')
          .reduce((e, t) => {
            const [n, ...i] = t.split('=')
            return n && i.length && (e[n] = i.join('=')), e
          }, {})
      }

      /**
       * 发送HTTP请求
       * @param {string} e - 请求URL
       * @param {string} t - 请求方法(GET/POST)
       * @param {Object} n - 请求参数对象
       * @param {Object} [i={}] - 请求头配置
       * @returns {Promise} 返回解析后的JSON响应
       */
      function V(e, t, n, i = {}) {
        const o = f(n, C.appId, C.appKey),
          r = { ...n, appId: C.appId, sign: o }
        return 'GET' === t
          ? fetch(e + ('GET' === t ? '?' + p(r) : ''), { method: t, headers: i })
              .then((e) => e.json())
              .then((e) => {
                if (0 !== e.code) throw new Error(e.message)
                return e
              })
          : 'POST' === t
          ? fetch(e, { method: t, headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, body: p(r) })
              .then((e) => e.json())
              .then((e) => {
                if (0 !== e.code) throw new Error(e.message)
                return e
              })
          : Promise.reject(`unsupported request method: ${t}`)
      }

      t().error((e) => {
        console.error('wx.error: ', e)
      })
      t().ready(() => {
        I = !0
      })
      A(document, 'WeixinJSBridgeReady', () => {
        console.log('WeixinJSBridgeReady')
      })

      /**
       * 显示模态对话框ID
       */
      let U = 0
      /**
       * 显示模态对话框
       * @param {Object} e - 对话框配置对象
       * @param {string} [e.title] - 对话框标题
       * @param {string} [e.content] - 对话框内容
       * @param {string} [e.icon] - 图标类名
       * @param {boolean} [e.showCancel=true] - 是否显示取消按钮
       * @param {boolean} [e.showConfirm=true] - 是否显示确认按钮
       * @param {string} [e.cancelText='取消'] - 取消按钮文本
       * @param {string} [e.confirmText='确定'] - 确认按钮文本
       * @param {Function} [e.onCancel] - 取消按钮回调
       * @param {Function} [e.onConfirm] - 确认按钮回调
       * @returns {Function} 返回一个关闭对话框的函数
       */
      function _(e) {
        const t = U++,
          n = []
        !1 !== e.showCancel &&
          n.push(
            M(
              'div',
              {
                classes: ['button'],
                onClick: () => {
                  e?.onCancel?.(), R(t)
                }
              },
              [e.cancelText || '取消']
            )
          ),
          !1 !== e.showConfirm &&
            n.push(
              M(
                'div',
                {
                  classes: ['button', 'primary'],
                  onClick: () => {
                    e?.onConfirm?.(), R(t)
                  }
                },
                [e.confirmText || '确定']
              )
            )
        const i = []
        e.icon && i.unshift(M('div', { classes: ['modal-icon', e.icon] }, []))
        e.title && i.push(M('div', { classes: ['modal-title'] }, [e.title]))
        e.content && i.push(M('div', { classes: ['modal-content'] }, [e.content]))

        const o = M('div', { classes: ['modal-backdrop'] }, [
          M('div', { id: `modal-${t}`, classes: ['modal-container'] }, [
            M('div', { classes: ['modal-body'] }, i),
            M('div', { classes: ['modal-footer'] }, n)
          ])
        ])
        return document.body.appendChild(o), () => R(t)
      }

      /**
       * 移除指定ID的模态对话框
       * @param {number} e - 要移除的对话框ID
       */
      function R(e) {
        document.querySelector(`#modal-${e}`)?.parentElement?.remove()
      }
      /**
       * 为元素添加事件监听器
       * @param {HTMLElement} e - 要添加事件的DOM元素
       * @param {string} t - 事件类型(如'click')
       * @param {Function} n - 事件处理函数
       */
      function A(e, t, n) {
        const i = e['on' + t]
        e['on' + t] = function (e) {
          let t = n(e)
          return !1 !== t && ('function' != typeof i || ((t = i(e)), !1 !== t)) && void 0
        }
      }
      /**
       * 生成微信JS-SDK签名
       * @param {string} e - JSAPI票据(jsapi_ticket)
       * @param {string} t - 当前网页URL
       * @returns {Promise<Object>} 包含签名信息的对象
       */
      async function L(e, t) {
        const n = {
            jsapi_ticket: e,
            nonceStr: Math.random().toString(36).substr(2, 15),
            timestamp: parseInt((new Date().getTime() / 1e3).toString()),
            url: t
          },
          i = (function (e) {
            const t = Object.keys(e).sort(),
              n = {}
            t.forEach(function (t) {
              n[t.toLowerCase()] = e[t]
            })
            let i = ''
            for (const e in n) i += '&' + e + '=' + n[e]
            return (i = i.substr(1)), i
          })(n),
          o = await crypto.subtle.digest('SHA-1', new TextEncoder().encode(i)),
          r = Array.from(new Uint8Array(o))
            .map((e) => e.toString(16).padStart(2, '0'))
            .join('')
        return (n.signature = r), n
      }

      /**
       * 从localStorage获取指定key的值
       * @param {Object} e - 参数对象
       * @param {string} e.key - 要获取的键名
       * @param {Function} e.success - 成功回调函数，参数为{data: value}
       */
      function N(e) {
        try {
          const t = localStorage.getItem(e.key)
          e.success({ data: t })
        } catch (e) {
          console.log(e)
        }
      }
      /**
       * 将二进制数据转换为大整数
       * @param {ArrayBuffer} e - 要转换的二进制数据
       * @param {boolean} [t=true] - 是否使用小端序(默认true)
       * @returns {BigInt} 转换后的大整数
       */
      function P(e, t = !0) {
        const n = new DataView(e),
          i = []
        for (let e = 0; e < n.byteLength; e += 4) {
          const o = n.getUint32(e, t)
          i.push(o)
        }
        return t
          ? i.reduce((e, t, n) => e + BigInt(t) * BigInt(2 ** (32 * n)), 0n)
          : i.reduceRight((e, t, n) => e + BigInt(t) * BigInt(2 ** (32 * n)), 0n)
      }
      /**
       * 将字符串转换为UTF-8编码的字节数组
       * @param {string} e - 要转换的字符串
       * @returns {Array} 包含UTF-8编码字节的数组
       */
      function O(e) {
        const t = new Array()
        let n, i
        n = e.length
        for (var o = 0; o < n; o++)
          (i = e.charCodeAt(o)),
            i >= 65536 && i <= 1114111
              ? (t.push(((i >> 18) & 7) | 240),
                t.push(((i >> 12) & 63) | 128),
                t.push(((i >> 6) & 63) | 128),
                t.push((63 & i) | 128))
              : i >= 2048 && i <= 65535
              ? (t.push(((i >> 12) & 15) | 224), t.push(((i >> 6) & 63) | 128), t.push((63 & i) | 128))
              : i >= 128 && i <= 2047
              ? (t.push(((i >> 6) & 31) | 192), t.push((63 & i) | 128))
              : t.push(255 & i)
        return t
      }
      /**
       * 向Web Worker发送消息
       * @param {Worker} e - 目标Web Worker实例
       * @param {Object} t - 要发送的消息对象
       * @param {string} t.work - 工作类型('init-weco'|'scan')
       */
      async function W(e, t) {
        switch (t.work) {
          case 'init-weco':
            e.postMessage(t, [t.keyPairs.buffer])
            break
          case 'scan':
            e.postMessage(t, [t.src.buffer])
        }
      }
      /**
       * 向授权Worker发送消息
       * @param {Worker} e - 目标授权Worker实例
       * @param {Object} t - 要发送的消息对象
       * @param {string} t.work - 工作类型('verify-app-key'|'authorize'|'transform')
       */
      async function B(e, t) {
        switch (t.work) {
          case 'verify-app-key':
          case 'authorize':
            e.postMessage(t)
            break
          case 'transform':
            const n = new Uint8Array(O(P(t.code.buffer).toString()))
            ;(t.code = n), e.postMessage(t, [t.code.buffer])
        }
      }
      /** debug 模式 */
      const D = location.search.includes('_debug_')
      /** MicroMessenger 型号 微信环境 */
      const F = /MicroMessenger/i.test(navigator.userAgent)
      /** iphone 型号 */
      const j = /iphone/i.test(navigator.userAgent)
      /** Android 型号 */
      const Q = /Android/i.test(navigator.userAgent)
      /** 解码器宿主容器DOM元素引用 */
      let z
      /** video对象 */
      let J
      /** 遮罩层中间区域DOM元素引用 */
      let Z
      /** 摄像头权限状态标志，false表示用户未授权摄像头权限 */
      let $ = !1
      /** 摄像头硬件支持状态标志，false表示设备不支持摄像头功能 */
      let q = !1
      /** JSBridge初始化状态 */
      let G = !1
      /** 视频播放状态标志，false表示视频未开始播放 */
      let H = !1
      /** 视频流启动状态标志，false表示视频流未启动 */
      let X = !1

      /**
       * 获取画布上下文
       * @returns {CanvasRenderingContext2D} 返回2D画布上下文对象
       */
      function K() {
        if ('undefined' == typeof OffscreenCanvas) {
          const e = M('canvas', { classes: ['hide'] })
          return (e.width = e.height = 480), z.appendChild(e), e.getContext('2d', { willReadFrequently: !0 })
        }
        return new OffscreenCanvas(480, 480).getContext('2d', { willReadFrequently: !0 })
      }
      /**
       * 创建并返回一个画布元素
       * @returns {HTMLCanvasElement|OffscreenCanvas} 返回创建的画布元素
       */
      function Y() {
        if ('undefined' == typeof OffscreenCanvas) {
          const e = M('canvas', { classes: ['hide'] })
          return (e.width = e.height = 480), z.appendChild(e), e
        }
        return new OffscreenCanvas(480, 480)
      }
      class ee extends Error {
        constructor(e) {
          super(e), (this.name = 'DecoderError')
        }
      }
      /**
       * 初始化并启动摄像头
       * @returns {Promise<boolean>} 返回一个Promise，解析为布尔值表示是否成功启动摄像头
       */
      async function te() {
        const { width: e, height: t } = z.getBoundingClientRect()
        if ($ || !J) return !1
        try {
          await b(J, e, t)
        } catch (e) {
          if (e instanceof DOMException) throw ((q = !0), new ee('当前设备无法调用相机，请检查'))
          if ('AbortError' === e.name) throw new ee(e.message)
          if ('摄像机使用权限被拒绝' === e.message) throw (($ = !0), e)
          if ('OverconstrainedError' === e.name) throw new ee('当前设备相机不满足sdk必要的使用条件')
          if ('ConstraintNotSatisfiedError' === e.name) throw new ee('当前设备不支持2k分辨率')
          throw e
        }
        return $ || q || (await pe()), ue(), !0
      }
      /** 状态枚举 */
      var ne
      !(function (e) {
        ;(e[(e.init = 0)] = 'init'), (e[(e.ready = 1)] = 'ready'), (e[(e.running = 2)] = 'running')
      })(ne || (ne = {}))
      /** 解码器实例数组，存储各分辨率解码器状态 */
      let ie = []
      /** Web Worker实例数组，用于并行解码 */
      let oe = []
      /** 顶部遮罩位置偏移量(像素) */
      let re = ''
      /** 左侧遮罩位置偏移量(像素) */
      let ae = ''
      /** 最后一帧图像数据引用 */
      let se
      /** 解码结果缓存数组，存储最近12个解码结果 */
      let ce = []
      /** 解码成功回调函数引用 */
      let de = null
      /** 最后一帧回调函数引用 */
      let le = null
      /**
       * 调整视频元素和遮罩元素的尺寸和位置
       * 1. 计算视频显示区域的最佳尺寸
       * 2. 根据设备类型(Android/iOS)设置不同的显示方式
       * 3. 更新遮罩元素的尺寸和位置
       */
      function ue() {
        if (!z) return
        const { width: e, height: t } = z.getBoundingClientRect(),
          n = t > e ? (2 * e) / 3 : (2 * t) / 3
        if (Q) {
          const e = n / 480,
            t = J.videoWidth * e
          J.width = t
        }
        const i = n / 480
        Q || (J.style.transform = `translate(-50%, -50%)scale(${i})`),
          (Z.style.height = n + 'px'),
          (Z.style.width = n + 'px'),
          (re = (t - n) / 2 + 'px'),
          (ae = (e - n) / 2 + 'px')
      }
      /**
       * 处理视频元数据加载完成后的逻辑
       * 1. 检查视频元素是否已加载元数据
       * 2. 在微信环境下检查JSBridge是否就绪
       * 3. 所有解码器worker准备就绪后开始播放视频
       */
      async function he() {
        if (
          void 0 !== J &&
          J.readyState >= J.HAVE_METADATA &&
          (!F || G) &&
          ie.every((e) => e.stat === ne.ready) &&
          !X
        ) {
          X = !0
          try {
            await pe()
          } catch (e) {}
        }
      }
      /**
       * 尝试播放视频流
       * 1. 检查是否已初始化摄像头(E标志)
       * 2. 显示视频元素并尝试播放
       * 3. 更新播放状态标志(H)
       */
      async function pe() {
        if (!E) return await te()
        if ((J.classList.remove('hide'), !H))
          try {
            await J.play(), (H = !0)
          } catch (e) {
            H = !1
          }
      }
      class fe extends Error {
        constructor() {
          super('不支持32位版本的微信\n请重新安装64位版本的微信'), (this.name = 'PlatformError')
        }
      }
      /**
       * 初始化并配置视频解码器
       * @param {string} e - 视频元素的CSS选择器
       * @param {Function} t - 解码成功回调函数
       * @param {Object} n - 配置选项
       * @param {number} [n.resolution=2048] - 视频分辨率
       * @param {number} [n.size=480] - 视频显示尺寸
       * @param {Function} [n.on_last_frame] - 最后一帧回调
       * @returns {Promise<boolean>} 返回一个Promise，解析为布尔值表示是否成功初始化
       */
      async function ge(e, t, n) {
        if (/WeChat\/arm32/i.test(navigator.userAgent)) throw new fe()
        return (
          (z = document.querySelector(e)),
          D && z.classList.add('debug'),
          (Z = z.querySelector('.mask .middle')),
          (J = z.querySelector('#video')),
          J.addEventListener('loadedmetadata', he, { once: !0 }),
          J.addEventListener('pause', () => {
            ;(H = !1),
              me &&
                !H &&
                J.play()
                  .then(() => {
                    H = !0
                  })
                  .catch(() => {
                    H = !1
                  })
          }),
          (de = t),
          (le = n.on_last_frame),
          await te()
        )
      }
      /** 解码器运行状态标志，false表示解码器未运行 */
      let me = !1
      /** 解码帧计数器，记录已处理的帧数 */
      let ye = 0
      /** 扫描延迟计数器，用于控制扫描频率 */
      let we = 0
      /**
       * 初始化并配置Web Worker解码器
       * @param {Array} e - 密钥对数组
       * @param {Array} t - 维度配置数组
       */
      function ve(e, t) {
        ;(oe = []),
          (ie = [
            { stat: ne.init, sz: 480, dx: -0.5, dy: -0.5, ctx: K(), frame: Y() },
            { stat: ne.init, sz: 240, dx: -0.5, dy: -0.5, ctx: K() }
          ]),
          j ||
            ie.push(
              { stat: ne.init, sz: 160, dx: -1.25, dy: -1, ctx: K() },
              { stat: ne.init, sz: 160, dx: -1.25, dy: 0, ctx: K() },
              { stat: ne.init, sz: 160, dx: 0.25, dy: -1, ctx: K() },
              { stat: ne.init, sz: 160, dx: 0.25, dy: 0, ctx: K() }
            ),
          ie.forEach(async (n, i) => {
            const o = (function (e) {
              const t = new Worker(new URL(a.p + a.u(182), a.b))
              return (t.onmessage = (t) => e(t.data)), t
            })((e) =>
              // index data
              (function (e, t) {
                switch (((ie[e].stat = ne.ready), t.work)) {
                  case 'weco-ready':
                    he()
                    break
                  case 'decode':
                    if (0 === t.subcode.length) break
                    for (let n = 0; n < t.code.length; n += 16) {
                      const i = t.code.slice(n, n + 16)
                      ce.push({ subcode: Math.floor(t.subcode[n / 16] / 4), code: i, sid: e })
                    }
                    ce.length > 12 && (ce = ce.slice(ce.length - 12))
                }
              })(i, e)
            )
            W(o, { work: 'init-weco', keyPairs: e.slice(), dims: t.slice() }), oe.push(o)
          })
      }
      /**
       * 启动解码器扫描功能
       * 1. 清空之前的解码结果缓存
       * 2. 设置解码器运行标志
       * 3. 初始化扫描延迟计数器
       * 4. 开始第一帧扫描
       */
      function Te() {
        ;(ce.length = 0), (me = !0), (we = 12), Ee(0)
      }
      /**
       * 解码器扫描帧处理函数
       * @param {number} e - 当前动画帧时间戳
       */
      function Ee(e) {
        if ((ce.length > 0 && de && (de(ce.slice()), (ce.length = 0)), me)) {
          if (we > 0) return --we, requestAnimationFrame(Ee)
          oe.forEach(async (e, t) => {
            if (ie[t].stat !== ne.ready) return
            ie[t].stat = ne.running
            const { sz: n, dx: i, dy: o, ctx: r, frame: a } = ie[t]
            W(e, { work: 'scan', src: k(J, n, i, o, r, ye % 8 != 0) }),
              a &&
                (!(function (e, t, n, i, o) {
                  const [r, a] =
                      e instanceof HTMLImageElement ? [e.naturalWidth, e.naturalHeight] : [e.videoWidth, e.videoHeight],
                    s = Math.min(r, t),
                    c = Math.min(a, t),
                    d = Math.max(0, Math.min(r - s, r / 2 + n * s)),
                    l = Math.max(0, Math.min(a - c, a / 2 + i * c)),
                    u = c / s
                  o.drawImage(e, d, l, s, c, 0, 0, 480, 480 * u), o.getImageData(0, 0, 480, 480)
                })(J, n, i, o, a.getContext('2d', { willReadFrequently: !0 })),
                (se = a))
          }),
            ++ye,
            requestAnimationFrame(Ee)
        }
      }

      // 微信环境下的WeixinJSBridgeReady事件监听
      // 当微信JSBridge准备就绪时：
      // 1. 设置G标志为true表示微信环境已就绪
      // 2. 调用he()函数处理相关逻辑
      // {once: true}表示该监听器只执行一次
      F &&
        document.addEventListener(
          'WeixinJSBridgeReady',
          () => {
            ;(G = !0), he()
          },
          { once: !0 }
        )
      class Se extends Error {
        constructor(e) {
          super(e), (this.name = 'AuthError')
        }
      }
      const be = {
        development: 'http://192.168.110.82:8004/v3/codeValue/auth/open/findWd',
        test: 'http://192.168.110.81:8004/v3/codeValue/auth/open/findWd',
        preview: 'https://rerearpre.wecodetrace.com/v3/codeValue/auth/open/findWd',
        production: 'https://rerear.wecodetrace.com/v3/codeValue/auth/open/findWd'
      }
      /**
       * 解码器主类，负责管理整个解码流程
       * 1. 初始化配置和状态
       * 2. 挂载DOM元素和视频流
       * 3. 处理授权和扫描逻辑
       * 4. 提供控制接口(暂停/恢复/销毁等)
       */
      class ke {
        constructor(e) {
          if (
            ((this.config = {
              mount: '#wecode-decoder',
              showLoading: !0,
              loadingText: '加载中...',
              size: 480,
              authServer: be.production,
              _onLastFrame: (e) => {}
            }),
            (this.version = a(661).i8),
            (this.initialized = !1),
            'object' != typeof e)
          )
            throw new ee('请使用合法配置项初始化')
          ;(this.config = { ...this.config, ...e }),
            e.authServer && e.authServer.endsWith('/') && (e.authServer = e.authServer.slice(0, -1))
        }
        /**
         * 挂载解码器DOM结构
         * 1. 创建视频元素并设置基本属性
         * 2. 创建遮罩层和扫描框结构
         * 3. 将元素添加到宿主容器中
         * 4. 显示加载状态
         */
        mount() {
          if (((this.hostEl = document.querySelector(this.config.mount)), !this.hostEl))
            throw new ee(`无法挂载实例到"${this.config.mount}"节点`)
          this.hostEl.classList.add('wecode-decoder')
          const e = M('video', { id: 'video', classes: ['hide'] })
          ;(e.muted = !0),
            (e.playsInline = !0),
            e.setAttribute('x5-video-player-type', 'h5'),
            this.hostEl.appendChild(e)
          const t = M('div', { classes: ['mask'] }),
            n = M('div', { classes: ['left'] })
          t.appendChild(n)
          const i = M('div', { classes: ['center'] })
          ;['top', 'middle', 'bottom'].forEach((e) => {
            const t = M('div', { classes: [e] })
            i.appendChild(t),
              'middle' === e &&
                (t.appendChild(M('div', { classes: ['inner'] })),
                t.appendChild(M('div', { classes: ['inner'] })),
                t.appendChild(M('div', { classes: ['inner'] })),
                t.appendChild(M('div', { classes: ['inner'] })),
                t.appendChild(M('div', { classes: ['inner'] })),
                t.appendChild(M('div', { classes: ['inner'] })),
                t.appendChild(M('div', { classes: ['inner'] })),
                t.appendChild(M('div', { classes: ['inner'] })))
          }),
            t.appendChild(i)
          const o = M('div', { classes: ['right'] })
          t.appendChild(o), this.hostEl.appendChild(t), this.showLoading()
        }
        /**
         * 从授权服务器获取授权文件
         * @param {string} e - 租户代码(tenantCode)
         * @param {boolean} t - 是否官方授权(isOfficial)
         * @returns {Promise<Array>} 返回包含授权文件内容的数组
         * @throws {Se} 当接口返回错误或数据结构不合法时抛出AuthError
         */
        async getServerAuthFile(e, t) {
          const n = { tenantCode: e, isOfficial: t },
            i = f(n, this.config.authAppId, this.config.authAppKey),
            {
              data: o,
              code: r,
              message: a
            } = await fetch(
              `${this.config.authServer}?${p({
                appId: this.config.authAppId || g('production').appId,
                sign: i,
                ...n
              })}`,
              { method: 'GET' }
            ).then((e) => e.json())
          if (0 === r) {
            if (!Array.isArray(o) || 'string' != typeof o[0] || 0 === o[0].length) throw new Se('接口返回数据结构错误')
            return o
          }
          throw new Se(a)
        }
        /**
         * 启动解码器
         * 1. 检查是否已挂载DOM元素，未挂载则尝试挂载
         * 2. 如果已初始化则直接开始扫描
         * 3. 否则初始化解码器和授权流程
         * 4. 处理初始化过程中的错误
         * @returns {Promise} 返回启动过程的Promise
         */
        start() {
          if (!this.hostEl)
            try {
              this.mount()
            } catch (e) {
              return this.hideLoading(), this.onError(e), Promise.reject()
            }
          return this.initialized
            ? (this.hideLoading(), Te(), Promise.resolve())
            : Promise.all([
                ge(
                  this.config.mount,
                  (e) => {
                    B(this.authWorker, { work: 'transform', subcode: e[0].subcode, code: e[0].code })
                  },
                  {
                    resolution: this.config.$resolution$ || 2048,
                    size: this.config.size,
                    on_last_frame: this.config._onLastFrame
                  }
                ),
                this.authorize()
              ])
                .then(([e, { keyPairs: t, dims: n }]) => {
                  try {
                    ve(t, n), Te(), (this.initialized = !0), this.hideLoading()
                  } catch (e) {
                    if ((this.hideLoading(), 'AbortError' === e.name)) return Te(), void (this.initialized = !0)
                    this.onError(e)
                  }
                })
                .catch((e) => {
                  throw (this.hideLoading(), this.onError(e), e)
                })
        }
        /**
         * 处理授权流程
         * 1. 创建授权Worker并设置消息处理器
         * 2. 根据授权文件来源(本地配置或远程获取)进行授权
         * 3. 处理授权过程中的各种状态和错误
         * @returns {Promise} 返回授权流程的Promise
         */
        authorize() {
          return new Promise((e, t) => {
            try {
              ;(this.authWorker = (function (e) {
                const t = new Worker(new URL(a.p + a.u(787), a.b))
                return (t.onmessage = (t) => e(t.data)), t
              })((n) => {
                switch (n.work) {
                  case 'auth-file':
                    'string' == typeof this.config.authContent
                      ? B(this.authWorker, { work: 'authorize', authFile: [this.config.authContent] })
                      : this.getServerAuthFile(this.config.appId, n.flag)
                          .then((e) => {
                            B(this.authWorker, { work: 'authorize', authFile: e })
                          })
                          .catch((e) => {
                            'AuthError' === e.name && t(e), t(new ee('授权接口请求失败'))
                          })
                    break
                  case 'authorized':
                    e({ keyPairs: n.keyPairs, dims: n.dims })
                    break
                  case 'transform':
                    this.onSuccess({ code: `${n.identity}-${n.code}`, tenantCode: n.tenantCode, raw: n.raw })
                    break
                  case 'auth-error':
                    const i = new Error(n.message)
                    ;(i.name = n.type), t(i)
                }
              })),
                B(this.authWorker, {
                  work: 'verify-app-key',
                  appId: this.config.appId,
                  appKey: this.config.appKey,
                  identifier: this.config.$identifier$ || window.location.origin
                })
            } catch (e) {
              t(new ee('加载授权wasm文件失败'))
            }
          })
        }
        /**
         * 显示加载状态
         * @param {Object} [e] - 可选配置对象
         * @param {string} [e.title] - 自定义加载文本
         */
        showLoading(e) {
          if (this.config.showLoading) {
            if (void 0 === this.loading) {
              ;(this.loading = M('div', { classes: ['loading'] })),
                this.loading.appendChild(M('div', { classes: ['spinner'] }))
              const t = M('p', { classes: [] })
              ;(t.textContent = e?.title ?? this.config.loadingText),
                this.loading.appendChild(t),
                this.hostEl.appendChild(this.loading)
            }
            ;(this.loading.querySelector('p').textContent = e?.title ?? this.config.loadingText),
              this.loading.classList.remove('hide')
          }
        }
        hideLoading() {
          this.config.showLoading && this.loading && this.loading.classList.add('hide')
        }
        onSuccess(e) {
          console.log('解码成功', e)
        }
        onError(e) {
          console.error('解码失败', e)
        }
        pause() {
          me = !1
        }
        destroy() {
          if ((this.pause(), this.hostEl))
            for (; this.hostEl.children.length; ) this.hostEl.removeChild(this.hostEl?.children.item(0))
        }
        getPosition() {
          return { top: re, left: ae }
        }
        resize() {
          ue()
        }
        getLastFrame() {
          if (!this.initialized) throw new ee('请先初始化解码器')
          se && (le(se), (se = null))
        }
      }

      const Ce = a.p + 'ebab96e6ea6220f6e643.mp3',
        Ie = a.p + '526c1b2114e643f32043.png',
        Me = a.p + 'd8399b521c8bd2de7cca.png',
        xe = a.p + '56a82acf63f65625a08d.png',
        Ve = a.p + 'e46c29a23e5614704358.gif'

      /** 插件 枚举 */
      var Ue
      !(function (e) {
        ;(e[(e.uniTag = 1)] = 'uniTag'), (e[(e.common = 2)] = 'common')
      })(Ue || (Ue = {}))

      /**
       * 解码器主控制器类
       * 1. 管理解码器生命周期(初始化、启动、暂停、销毁等)
       * 2. 处理扫码结果和错误
       * 3. 提供插件系统扩展功能
       * 4. 管理DOM元素和用户交互
       */
      class _e {
        constructor() {
          ;(this.paused = !1), (this.error = null), (this.plugins = [])
        }
        get running() {
          return !this.paused && null === this.error
        }
        /**
         * 挂载解码器DOM结构
         * 1. 创建视频元素并设置基本属性(muted, playsInline等)
         * 2. 创建遮罩层和扫描框结构
         * 3. 将元素添加到宿主容器中
         * 4. 显示加载状态
         * @throws {ee} 当无法找到挂载节点时抛出DecoderError
         */
        mount() {
          ;(this.queries = x()),
            (this.appEl = document.querySelector('#app')),
            (this.operatesEl = this.appEl.querySelector('.operates')),
            (this.beepEl = document.getElementById('beep')),
            (this.beepEl.onended = () => {
              this.beepEl.load()
            }),
            this.plugins.forEach((e) => {
              e.onMount && e.onMount()
            }),
            this.initDecoder().then(() => {
              this.running &&
                this.plugins.forEach((e) => {
                  e.onStarted()
                })
            })
        }
        /**
         * 初始化解码器
         * 1. 销毁之前的解码器实例(如果存在)
         * 2. 创建新的解码器实例并配置
         * 3. 设置解码成功和失败的回调处理
         * 4. 启动解码器并处理启动结果
         * @returns {Promise} 返回初始化解码器的Promise
         */
        initDecoder() {
          this.decoder?.destroy()
          const e = document.querySelector('#last-frame')
          return (
            (this.decoder = new ke({
              mount: '#wecode-decoder',
              appId: 'wecode',
              appKey:
                'd2Vjb2RlI01JSUNkd0lCQURBTkJna3Foa2lHOXcwQkFRRUZBQVNDQW1Fd2dnSmRBZ0VBQW9HQkFKZXp3cnZXajF1NzZWQllLdTJOWlZBZE9WZEMyaW1FcUtMQmhjbmZ2enllaFI2K1ltVkdPS3h2NHBGRU5DQkNBQmptTnNZTThXbEJSZ0FCNDd6ODN0Wm1SMUJkVEF1NXNXY21GOWpHL254SEMxeEQ3MW13WjBRTGQveTFybFV3L1UxMmk5V3hvNFRBK08wVlRMSFVvVWlLL0dNUTg2ODNiMElYeGQrVmVjM3BBZ01CQUFFQ2dZQXhEZWZDWmJjbHFyWGZUU05VZll4dFE0WHZPYWJpRmd1UjFaSTFuU3h4cGJEV0tDb1pKWVBkL3EvODJWa2h0VFhpMTA2TzdGQ0VBSjlxRVRKYlFrbXIrdjRQL3hUdXhsWkRFU3ZzRkZxMUxVVCtkdXBCc2JyZVNTelFPVG83TGJiRi8vNFNNVHM0NThYd0VPc1JuOGRrRzNrUlVGQ3U4MUlJODRJSzJvR29nUUpCQU03RDVVREpLbnQ3c1dIUXlUSU5KTSsxTHFmR0FDMU1RTUxady9udEhSNzU5c1VUMkdTNmpnMzRxbFUxUUNla2U3TzR4ZWliMTlnMmI2ZGlsNjRQR28wQ1FRQzcwMDNFYVpZRWRHbWUvSldlVk56VWVMcnlqSmVCeTBqUTErWWhNb1paZ05SWEtGVGRheHk5UWtTWnNBSWVWWkRLN2FTVkNnNEZuK0swU2l5WXNuZk5Ba0J1UHdWK0JjVWhFbE1DVk5EeVh3L0JzRm13RzJMOHhDdkR1VmxGYWFpZFc2cTRhbHgzV1FGbGNiRmd2WVAzbnp4V0Y2OXUxNm0vSDBkcGVLaG5wcVlCQWtFQW9XRGpYNC9zMG5VSFR3L3NxYloyYXFRMDFET1I5WFlwWVM4dlRuU3YxSFVKZkwxdGRUVVQ0MVR0eGpMaER4a3JwLy9aT2lrQ2RUaXp1MzVEcFFzcVBRSkJBTC9RcjNxUDZaU0hrZk1NL2Q2d0poV05OU3I1dmM4ekhDVi9QTVl0STl3NmFNRjhjWmk1RU8veElSanNDdFkxQ1ZzRmptSjBiV0s5Q3lrUHdjQkpubFE9IzEjMCNCNjhIc2xSWHJENzdEOFlvUHVTMmFGaXpCTkg2cDE0UFhBZUF5UjMzUU9uL3dFZXh6dUtjMjNPNlBQOWcwSmpGcXBqRHJTTHB4RkdnK3l5WDdVN05ONy9kdzVoODFweDc0MXdBaUI3MXNMaEtPZWh0VnRlTytMMVVOTUdqVkFhZmxNSmhKYWROTHUzKzVvSXljQlRPd2FjM1R3RnppMG1wWjl0TEZGQWFXMDQ9I01JR2ZNQTBHQ1NxR1NJYjNEUUVCQVFVQUE0R05BRENCaVFLQmdRQ2JHbUFXQ2xQMkkwYXNTRVhxdXRPcnhMUDJPVXpZbUxmdWhBSVUyQ1NrcWdVYUx2QVk1WjhxeEpYQldVK0phWmNDYkZoQi8wRmo3Y1RKSytSSkZkQ3YzY0ZGL3lpK1M0N1ZYcUNzMnppMkxtZFduZDB5amo5SVVFMitIZkZYcHpBbVA1NUJzYWFBRzhRamhQdlZvVnBxbXFseHZzVmZ3SWYxcjJoeW50cmg4d0lEQVFBQg==',
              _onLastFrame: (t) => {
                e.getContext('2d').drawImage(t, 0, 0, 126, 126)
              }
            })),
            (this.decoder.onSuccess = ({ code: e, tenantCode: t, raw: n }) => {
              if (this.paused) return
              const i = t || 'wecode'
              this.pause()
              try {
                ;(this.beepEl.playbackRate = 2), this.beepEl.play()
              } catch (e) {}
              if ('_debug_' === this.queries.mode)
                return (
                  this.decoder.hostEl.classList.add('decoded'),
                  setTimeout(() => {
                    this.decoder.hostEl.classList.remove('decoded')
                  }, 100),
                  void console.log('>>> scan result:\n', `${e} --- ${i}`, n)
                )
              for (const t of this.plugins) if (t.onDecode(e, i)) return
              this.processNormalCode(e, i)
            }),
            (this.decoder.onError = (e) => {
              switch (((this.error = e), e.name)) {
                case 'PlatformError':
                  _({
                    title: '兼容性错误',
                    content: e.message,
                    showCancel: !1,
                    onConfirm() {
                      try {
                        t()?.miniProgram?.navigateTo({ url: '../version-wechat/index' })
                      } catch (e) {}
                    }
                  })
                  break
                case 'DecoderError':
                  if ('摄像机权限被拒绝' === e.message) {
                    try {
                      t()?.miniProgram?.reLaunch({ url: '/pages/home/home' })
                    } catch (e) {}
                    return
                  }
                  _({ title: '解码错误', content: e.message, showCancel: !1 })
                  break
                case 'CompatibilityError':
                  _({
                    title: '兼容性错误',
                    content: e.message,
                    showCancel: !1,
                    onConfirm() {
                      try {
                        t()?.miniProgram?.navigateTo({ url: '../version/index' })
                      } catch (e) {}
                    }
                  })
                  break
                case 'AuthError':
                  _({ title: '授权错误', content: e.message, showCancel: !1 })
                  break
                default:
                  console.log('decoder error:', e)
              }
              this.plugins.forEach((t) => {
                t.onError(e)
              })
            }),
            this.decoder.start().then(() => {
              ;(this.paused = !1), this.onresize()
            })
          )
        }
        restart() {
          this.decoder?.start().then(() => {
            ;(this.paused = !1),
              this.onresize(),
              this.plugins.forEach((e) => {
                e.onRestart()
              })
          })
        }
        /**
         * 处理普通码值的解码结果
         * 1. 解析码值获取租户代码和码值编号
         * 2. 根据码值类型(62/63开头)进行特殊处理
         * 3. 获取码值详细信息并处理溯源链接
         * 4. 导航到详情页面或处理错误情况
         * @param {string} e - 解码得到的完整码值(格式: "前缀-编号")
         * @param {string} t - 租户代码(tenantCode)
         * @returns {Promise<void>}
         */
        async processNormalCode(e, t) {
          const [o, r] = e.split('-'),
            a = o.substring(1, 3)
          if ('62' === a || '63' === a) {
            const n = f({ noValue: r, fullNoValue: e, tenantCode: t, type: '10' })
            return this.navigateTo(
              `../detail/detail?url=${encodeURIComponent(
                `${i}?noValue=${r}&fullNoValue=${e}&tenantCode=${t}&sign=${n}&type=10`
              )}`,
              `${i}?noValue=${r}&fullNoValue=${e}&tenantCode=${t}&sign=${n}&type=10`
            )
          }
          this.showLoading({ title: '获取码值信息...' })
          try {
            const {
              code: i,
              data: o,
              errorMessage: r
            } = await V(`${n}/v1/codeValues/open/findByTenantCodeAndFullNoValue`, 'GET', {
              fullNoValue: e,
              tenantCode: t
            })
            if (0 !== i || !o) throw new Error(r)
            if (10 !== o.type)
              try {
                await this.uploadScanRecord(o, Ue.common)
              } catch (e) {
                console.log(e)
              }
            if (!o.traceUrl) throw new Error('当前码值无溯源链接')
            this.navigateTo(`../detail/detail?url=${encodeURIComponent(o.traceUrl)}`, o.traceUrl)
          } catch (e) {}
          this.hideLoading()
        }
        /**
         * 导航到指定页面
         * 1. 检查是否在微信小程序环境中
         * 2. 如果是小程序环境则使用小程序API导航
         * 3. 否则使用普通页面跳转
         * @param {string} e - 小程序导航路径(带参数)
         * @param {string} n - 普通页面跳转URL
         */
        navigateTo(e, n) {
          if (t() && t().miniProgram && t().miniProgram.getEnv) {
            const i = setTimeout(() => {
              window.location.href = n
            }, 100)
            t().miniProgram.getEnv(function (o) {
              clearTimeout(i), o.miniprogram ? t().miniProgram.navigateTo({ url: e }) : (window.location.href = n)
            })
          } else window.location.href = n
        }
        /**
         * 上传扫码记录
         * @param {Object} params - 扫码记录参数对象
         * @param {string} params.noValue - 码值编号
         * @param {string} params.tenantCode - 租户代码
         * @param {string} params.wecodeUrl - 扫码服务URL
         * @param {number} type - 扫码类型(1:uniTag, 2:common)
         * @returns {Promise} 返回上传结果的Promise
         */
        uploadScanRecord({ noValue: e, tenantCode: n, wecodeUrl: i }, o) {
          const r = this
          return new Promise((a, s) => {
            function c(t, c) {
              const d = JSON.stringify({ noValue: e, latitude: t, longitude: c, source: o })
              r.uploadScanInfo({ tenantCode: n, json: d, wecodeUrl: i }).then(a).catch(s)
            }
            !(function ({ success: e, fail: n, type: i }) {
              if (I) t().getLocation({ type: i, success: e, fail: n })
              else if ('geolocation' in navigator && 'getCurrentPosition' in navigator.geolocation) {
                let t = !1
                navigator.geolocation.getCurrentPosition(
                  (n) => {
                    ;(t = !0), e({ latitude: n.coords.latitude, longitude: n.coords.longitude })
                  },
                  (e) => {
                    ;(t = !0), n(e)
                  },
                  { enableHighAccuracy: !0, timeout: 1e4, maximumAge: 0 }
                ),
                  setTimeout(() => {
                    t || n(new Error('定位超时'))
                  }, 1e4)
              } else n(new Error('当前设备不支持定位'))
            })({
              type: 'wgs84',
              success({ latitude: e, longitude: t }) {
                c(e, t)
              },
              fail(e) {
                console.error(e), c(null, null)
              }
            })
          })
        }
        /**
         * 上传扫码信息到服务器
         * @param {Object} params - 上传参数对象
         * @param {string} params.json - JSON格式的扫码数据
         * @param {string} params.tenantCode - 租户代码
         * @param {string} params.wecodeUrl - 扫码服务URL
         * @returns {Promise} 返回上传结果的Promise
         * @throws {string} 当接口返回错误时抛出错误消息
         */
        async uploadScanInfo({ json: e, tenantCode: t, wecodeUrl: n }) {
          const i = await V(`${n}/v1/codeValues/open/scan`, 'POST', { json: e, tenantCode: t }),
            { code: o, message: r } = i
          if (0 !== o) throw r
        }
        onresize() {
          this.decoder.resize()
          const { top: e } = this.decoder.getPosition()
          this.plugins.forEach((t) => {
            t.onResize(e)
          })
        }
        use(e) {
          return e.install(this), this.plugins.push(e), this
        }
        addOperate(e) {
          this.operatesEl.appendChild(e)
        }
        pause() {
          this.decoder?.pause(), (this.paused = !0)
        }
        hideLoading() {
          this.decoder.hideLoading()
        }
        showLoading(e) {
          this.decoder.showLoading(e)
        }
      }
      /**
       * 插件基类，提供解码器插件的基本接口
       * 1. 提供插件生命周期方法(挂载/启动/重启等)
       * 2. 定义解码事件处理接口
       * 3. 提供错误处理接口
       */
      class Re {
        install(e) {
          this.app = e
        }
        onMount() {}
        onStarted() {}
        onRestart() {}
        onResize(e) {}
        onDecode(e, t) {
          return !1
        }
        onError(e) {}
      }
      /**
       * 微信小程序返回按钮插件
       * 1. 在小程序环境中添加返回按钮
       * 2. 点击按钮返回H5扫码页面
       * 3. 继承自Re基类，实现插件接口
       */
      class Ae extends Re {
        onMount() {
          t() &&
            t().miniProgram &&
            t().miniProgram.getEnv &&
            t().miniProgram.getEnv((e) => {
              if (e.miniprogram) {
                const e = new Image()
                e.src = Ie
                const n = M('div', { classes: ['btn'] }, [e])
                A(n, 'click', () => {
                  t()?.miniProgram.redirectTo({
                    url: `../scan-h5/index?from=${this.app.queries.from || 'home'}${
                      this.app.queries.user ? '&user=test' : ''
                    }`
                  })
                }),
                  this.app.addOperate(n)
              }
            })
        }
      }
      /**
       * 举报按钮插件类
       * 1. 继承自Re基类，实现举报功能
       * 2. 根据用户类型(test/正式)显示不同图标
       * 3. 点击后跳转到举报页面
       */
      class Le extends Re {
        onMount() {
          const e = new Image()
          e.src = 'test' === this.app.queries.user ? Me : xe
          const t = M('div', { classes: ['btn'] }, [e])
          A(t, 'click', () => {
            this.app.navigateTo(
              `../report/index?from=${o.web}${
                'test' === this.app.queries.user ? '&user=test' : ''
              }&ua=${encodeURIComponent(navigator.userAgent)}`,
              `https://h5.wecodetrace.com/report${'test' === this.app.queries.user ? '-test' : ''}?from=${
                o.web
              }&ua=${encodeURIComponent(navigator.userAgent)}`
            )
          }),
            this.app.addOperate(t)
        }
      }
      /**
       * 新手引导插件类
       * 1. 继承自Re基类，实现新手引导功能
       * 2. 管理引导步骤切换和状态保存
       * 3. 提供跳过引导选项
       */
      class Ne extends Re {
        onMount() {
          const e = document.querySelector('#guide')
          let t = 0
          function n() {
            if (((t = (t + 1) % 5), e.setAttribute('class', `step-${t}`), 4 === t)) {
              const e = document.querySelector('#guide-ignore')
              N({
                key: 'showGuide',
                success({ data: t }) {
                  e.checked = 'false' === t
                }
              }),
                A(e, 'change', () => {
                  var t
                  ;(t = { key: 'showGuide', data: e.checked ? 'false' : 'true' }), localStorage.setItem(t.key, t.data)
                })
            }
          }
          A(document.querySelector('#guide .close'), 'click', function () {
            e.setAttribute('class', 'step-0')
          }),
            document.querySelectorAll('#guide .button, #guide-btn').forEach((e) => {
              A(e, 'click', n)
            }),
            N({
              key: 'showGuide',
              success({ data: e }) {
                'false' !== e && n()
              }
            })
        }
      }
      /**
       * 超时检测插件类
       * 1. 继承自Re基类，实现超时检测功能
       * 2. 管理超时计时器和UI显示
       * 3. 提供重启按钮处理逻辑
       */
      class Pe extends Re {
        constructor() {
          super(...arguments), (this.timer = null)
        }
        onMount() {
          const e = document.querySelector('#restart-btn')
          ;(this.timeoutEl = document.querySelector('#timeout')),
            A(e, 'click', () => {
              this.timeoutEl.classList.remove('show'), this.app.restart()
            })
        }
        onStarted() {
          this.timeoutDetect()
        }
        timeoutDetect() {
          this.timer && clearTimeout(this.timer),
            (this.timer = window.setTimeout(() => {
              this.app.running &&
                (this.app.pause(), this.app.decoder?.getLastFrame(), this.timeoutEl.classList.add('show'))
            }, Pe.DECODE_MAX_TIMEOUT))
        }
        onRestart() {
          this.timeoutDetect()
        }
      }
      Pe.DECODE_MAX_TIMEOUT = 2e4
      /**
       * 通知提示插件类
       * 1. 继承自Re基类，实现周期性通知提示功能
       * 2. 管理通知显示间隔和动画效果
       * 3. 提供解码时自动关闭通知的逻辑
       */
      class Oe extends Re {
        constructor() {
          super(...arguments), (this.NOTICE_INTERVAL = 1e4)
        }
        onMount() {
          this.noticeEl = this.app.appEl.querySelector('.notice')
        }
        onStarted() {
          this.noticeEl &&
            (this.noticeEl.classList.remove('hide'),
            (this.noticeIntv = window.setInterval(() => {
              this.noticeEl.classList.add('show'),
                setTimeout(() => {
                  this.noticeEl.classList.remove('show')
                }, 4e3)
            }, this.NOTICE_INTERVAL)))
        }
        onResize(e) {
          this.noticeEl && (this.noticeEl.style.bottom = e)
        }
        onDecode() {
          return this.noticeIntv && clearInterval(this.noticeIntv), !1
        }
      }
      /**
       * 扫描提示插件类
       * 1. 继承自Re基类，实现扫描提示功能
       * 2. 管理扫描提示元素的显示和位置
       * 3. 在解码器启动时显示提示信息
       */
      class We extends Re {
        onMount() {
          this.tipEl = this.app.appEl.querySelector('.tip')
        }
        onStarted() {
          this.tipEl && this.tipEl.classList.remove('hide')
        }
        onResize(e) {
          this.tipEl && (this.tipEl.style.top = e)
        }
      }
      /**
       * uni-tag专用解码插件类
       * 1. 继承自Re基类，实现uni-tag特殊解码逻辑
       * 2. 管理uni-tag解码超时计时器
       * 3. 处理uni-tag解码成功/失败流程
       * 4. 提供伪品检测和反馈功能
       */
      class Be extends Re {
        constructor() {
          super(...arguments), (this.uniTagTimer = null)
        }
        onStarted() {
          'uni-tag' === this.app.queries.from &&
            (this.uniTagTimer = window.setTimeout(this.onUniTagDecodeFail, Be.UNI_TAG_DECODE_MAX_TIMEOUT))
        }
        onDecode(e, t) {
          if ((this.uniTagTimer && clearTimeout(this.uniTagTimer), 'uni-tag' === this.app.queries.from))
            return this.processUniTagCode(e, t), !0
        }
        onError() {
          this.uniTagTimer && clearTimeout(this.uniTagTimer)
        }
        onUniTagDecodeFail() {
          this.app.pause(),
            _({
              title: '扫码失败',
              content: '扫码时间过长，疑似伪品',
              confirmText: '重新扫码',
              cancelText: '去反馈',
              onConfirm: () => {
                this.app.restart(),
                  (this.uniTagTimer = window.setTimeout(this.onUniTagDecodeFail, Be.UNI_TAG_DECODE_MAX_TIMEOUT))
              },
              onCancel: () => {
                t()?.miniProgram.navigateTo({ url: '/pages/uni-tag/feedback/index' })
              }
            })
        }
        async processUniTagCode(e, i) {
          this.app.showLoading({ title: '获取码值信息...' })
          const o = { noValue: e.split('-')[1], tenantCode: i }
          try {
            const {
              code: e,
              data: i,
              errorMessage: r
            } = await V(`${n}/v1/codeValues/open/findByTenantCodeAndNoValue`, 'GET', o)
            if (0 !== e || !i) throw r
            try {
              await this.app.uploadScanRecord(i, Ue.uniTag)
            } catch (e) {
              console.log(e)
            }
            if (i.isCommon) {
              const e = await V(`${i.wecodeUrl}/v1/codeValues/open/findByTenantCodeAndNoValue`, 'GET', {
                noValue: i.noValue,
                tenantCode: i.tenantCode
              })
              if (0 !== e.code || !e.data) throw e.errorMessage
              t()?.miniProgram.postMessage({
                data: {
                  step: 2,
                  code: i.noValue,
                  tenantCode: i.tenantCode,
                  validateCode: e.data.relevanceCodeValue,
                  traceUrl: i.traceUrl
                }
              }),
                this.app.hideLoading(),
                t() && t().miniProgram && t().miniProgram.navigateBack && t().miniProgram.navigateBack({ delta: 1 })
            } else
              this.app.hideLoading(),
                t()?.miniProgram.redirectTo({
                  url: `/pages/uni-tag/result/index?result=fake&url=${encodeURIComponent(i.traceUrl)}`
                })
          } catch (e) {
            this.app.hideLoading(),
              _({
                title: '获取码值信息失败',
                content: '请重试',
                onConfirm: () => {
                  this.app.restart(),
                    (this.uniTagTimer = window.setTimeout(this.onUniTagDecodeFail, Be.UNI_TAG_DECODE_MAX_TIMEOUT))
                }
              })
          }
        }
      }
      Be.UNI_TAG_DECODE_MAX_TIMEOUT = 15e3
      /**
       * 音频引导插件类
       * 1. 继承自Re基类，实现音频引导功能
       * 2. 管理音频元素的创建和控制
       * 3. 提供播放/暂停音频的接口
       * 4. 处理微信环境下的特殊音频播放逻辑
       */
      const De = new (class extends Re {
        constructor() {
          super(...arguments), (this.mounted = !1), (this.playing = !1)
        }
        onMount() {
          ;(this.audioControlEl = M('div', { id: 'audio-control' })),
            A(this.audioControlEl, 'click', () => {
              this.audioEl?.paused ? this.play('user invoke') : this.pause()
            }),
            (this.containerEl = M('div', { id: 'media-guide' }, [
              M('div', { classes: ['wrapper'] }, [M('img', { src: Ve }), this.audioControlEl])
            ])),
            (this.audioEl = M('audio', { id: 'guide-audio', src: Ce })),
            A(this.audioEl, 'ended', () => {
              ;(this.playing = !1),
                this.audioControlEl.classList.remove('playing'),
                this.audioControlEl.classList.remove('muted'),
                (this.audioEl.currentTime = 0)
            }),
            A(this.audioEl, 'pause', () => {
              ;(this.playing = !1),
                this.audioControlEl.classList.remove('playing'),
                this.audioControlEl.classList.add('muted')
            }),
            A(this.audioEl, 'play', () => {
              this.audioControlEl.classList.add('playing'), this.audioControlEl.classList.remove('muted')
            })
        }
        onStarted() {
          this.mounted ||
            (this.app.appEl.appendChild(this.containerEl),
            this.app.appEl.appendChild(this.audioEl),
            (this.mounted = !0)),
            this.play('onStarted')
        }
        onResize(e) {
          this.containerEl.style.height = `calc(${e} - 120px)`
        }
        play(e) {
          this.audioEl.play().then(() => {
            this.playing = !0
          })
        }
        pause() {
          this.audioEl.pause()
        }
      })()

      /**
       * 微信JSBridge就绪事件监听器
       * 1. 当微信JSBridge准备就绪时触发
       * 2. 检查音频引导插件是否已挂载
       * 3. 如果音频未播放则自动播放引导音频
       * 4. 使用轮询方式确保插件完全初始化
       */
      document.addEventListener('WeixinJSBridgeReady', function () {
        !(function e() {
          De.mounted ? !1 === De.playing && De.play('WeixinJSBridgeReady detect') : setTimeout(e, 300)
        })()
      })
      /**
       * 初始化微信JS-SDK配置
       * 1. 接收回调函数和配置参数
       * 2. 根据配置决定是否使用微信JS-SDK
       * 3. 获取JSAPI票据并生成签名
       * 4. 配置微信JS-SDK
       * @param {Function} [e] - 成功回调函数，默认空函数
       * @param {Function} [n] - 失败回调函数，默认空函数
       * @param {Object} [i] - 配置对象，默认{vconsole: false, wxSDK: true}
       */
      ;(function (e = (e) => {}, n = (e) => {}, i = { vconsole: !1, wxSDK: !0 }) {
        function o() {
          if (i.wxSDK)
            try {
              !(async function (e, n) {
                try {
                  const i = 'https://cloud.channel.wecodetrace.com',
                    o = await V(i + '/v1/wechat/open/getJsapiTicket', 'GET', { timestamp: Date.now() })
                  if (0 === o.code) {
                    const n = await L(o.data, location.href.split('#')[0])
                    t().config({
                      debug: !1,
                      appId: 'wxbd5b5b0d319c1f61',
                      timestamp: n.timestamp,
                      nonceStr: n.nonceStr,
                      signature: n.signature,
                      jsApiList: ['getLocation', 'scanQRCode']
                    }),
                      e(!0)
                  } else n(o.message)
                } catch (e) {
                  n(e)
                }
              })(e, n)
            } catch (e) {
              n(e)
            }
          else e(!1)
        }
        'true' === x().vconsole
          ? a
              .e(400)
              .then(a.t.bind(a, 415, 23))
              .then(({ default: e }) => {
                new e()
              })
              .finally(o)
          : o()
      })(() => {
        A(window, 'pageshow', function (e) {
          e.persisted && window.location.reload()
        })
        const e = new _e()
        e.use(new Ae()).use(new Le()).use(new Ne()).use(new Pe()).use(new Oe()).use(new We()).use(De),
          e.mount(),
          A(window, 'resize', e.onresize.bind(e))
      })
    })()
})()
